Add support for baseurl

This commit is contained in:
Michael Rose
2016-02-22 16:16:15 -05:00
parent 4348fc59b3
commit 97b4571370
11 changed files with 115 additions and 65 deletions

View File

@ -1,3 +1,5 @@
{% capture absurl %}{{ site.url }}{{ site.baseurl }}{% endcapture %}
<!doctype html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if (IE 7)&!(IEMobile)]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]-->
@ -19,7 +21,7 @@
{% if page.image.feature contains 'http' %}
"{{ page.image.feature }}"
{% else %}
"{{ site.url }}/images/{{ page.image.feature }}"
"{{ page.image.feature | prepend: "/images/" | prepend: absurl }}"
{% endif %}
alt="{{ page.title }} feature image">
{% if page.image.credit %}
@ -33,13 +35,13 @@
{% include author-bio.html %}
</div>
<div id="index">
<h3><a href="{{ site.url}}/posts/">Recent Posts</a></h3>
<h3><a href="{{ absurl }}/posts/">Recent Posts</a></h3>
{% for post in site.posts limit:5 %}
<article>
{% if post.link %}
<h2 class="link-post"><a href="{{ site.url }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a> <a href="{{ post.link }}" target="_blank" title="{{ post.title }}"><i class="fa fa-link"></i></a></h2>
<h2 class="link-post"><a href="{{ absurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a> <a href="{{ post.link }}" target="_blank" title="{{ post.title }}"><i class="fa fa-link"></i></a></h2>
{% else %}
<h2><a href="{{ site.url }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></h2>
<h2><a href="{{ absurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></h2>
<p>{{ post.excerpt | strip_html | truncate: 160 }}</p>
{% endif %}
</article>

View File

@ -1,3 +1,5 @@
{% capture absurl %}{{ site.url }}{{ site.baseurl }}{% endcapture %}
<!doctype html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if (IE 7)&!(IEMobile)]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]-->
@ -19,7 +21,7 @@
{% if page.image.feature contains 'http' %}
"{{ page.image.feature }}"
{% else %}
"{{ site.url }}/images/{{ page.image.feature }}"
"{{ page.image.feature | prepend: "/images/" | prepend: absurl }}"
{% endif %}
alt="{{ page.title }} feature image">
{% if page.image.credit %}

View File

@ -1,3 +1,5 @@
{% capture absurl %}{{ site.url }}{{ site.baseurl }}{% endcapture %}
<!doctype html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if (IE 7)&!(IEMobile)]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]-->
@ -19,7 +21,7 @@
{% if page.image.feature contains 'http' %}
"{{ page.image.feature }}"
{% else %}
"{{ site.url }}/images/{{ page.image.feature }}"
"{{ page.image.feature | prepend: "/images/" | prepend: absurl }}"
{% endif %}
alt="{{ page.title }} feature image">
{% if page.image.credit %}
@ -43,9 +45,9 @@
{% endif %}
<article>
{% if post.link %}
<h2 class="link-post"><a href="{{ site.url }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a> <a href="{{ post.link }}" target="_blank" title="{{ post.title }}"><i class="fa fa-link"></i></a></h2>
<h2 class="link-post"><a href="{{ absurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a> <a href="{{ post.link }}" target="_blank" title="{{ post.title }}"><i class="fa fa-link"></i></a></h2>
{% else %}
<h2><a href="{{ site.url }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></h2>
<h2><a href="{{ absurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></h2>
<p>{{ post.excerpt | strip_html | truncate: 160 }}</p>
{% endif %}
</article>

View File

@ -1,3 +1,5 @@
{% capture absurl %}{{ site.url }}{{ site.baseurl }}{% endcapture %}
<!doctype html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if (IE 7)&!(IEMobile)]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]-->
@ -19,7 +21,7 @@
{% if page.image.feature contains 'http' %}
"{{ page.image.feature }}"
{% else %}
"{{ site.url }}/images/{{ page.image.feature }}"
"{{ page.image.feature | prepend: "/images/" | prepend: absurl }}"
{% endif %}
alt="{{ page.title }} feature image">
{% if page.image.credit %}
@ -37,7 +39,7 @@
{% if page.link %}
<h1><a href="{{ page.link }}">{{ page.title }}</a></h1>
{% else %}
<h1><a href="{{ site.url }}{{ page.url }}" rel="bookmark" title="{{ page.title }}">{{ page.title }}</a></h1>
<h1><a href="{{ absurl }}{{ page.url }}" rel="bookmark" title="{{ page.title }}">{{ page.title }}</a></h1>
{% endif %}
</div><!--/ .headline-wrap -->
<div class="article-wrap">
@ -57,10 +59,10 @@
<div class="footer-wrap">
{% if site.related_posts.size > 0 %}
<div class="related-articles">
<h4>You might also enjoy <small class="pull-right">(<a href="{{ site.url }}/posts/">View all posts</a>)</small></h4>
<h4>You might also enjoy <small class="pull-right">(<a href="{{ absurl }}/posts/">View all posts</a>)</small></h4>
<ul>
{% for post in site.related_posts limit:3 %}
<li><a href="{{ site.url }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></li>
<li><a href="{{ absurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
<hr />