Replace base_path with absolute_url filter

This commit is contained in:
Michael Rose 2016-11-04 12:50:03 -04:00
parent bdca8cab8b
commit b29e4bf5c9
9 changed files with 8 additions and 17 deletions

View file

@ -1,6 +1,5 @@
{% if site.comments.discourse.server %}
{% include base_path %}
{% capture canonical %}{{ base_path }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' | strip_slash }}{% endif %}{% endcapture %}
{% capture canonical %}{% if site.permalink contains '.html' %}{{ page.url | absolute_url }}{% else %}{{ page.url | absolute_url | remove:'index.html' | strip_slash }}{% endif %}{% endcapture %}
<script type="text/javascript">
DiscourseEmbed = { discourseUrl: '//{{ site.comments.discourse.server }}/',
discourseEmbedUrl: '{{ canonical }}' };

View file

@ -54,12 +54,12 @@
{% if paginator.page == paginator.total_pages %}
<li><a href="#" class="disabled current">{{ paginator.page }}</a></li>
{% else %}
<li><a href="{{ base_path }}/page{{ paginator.total_pages }}/">{{ paginator.total_pages }}</a></li>
<li><a href="{{ '/page' | absolute_url }}{{ paginator.total_pages }}/">{{ paginator.total_pages }}</a></li>
{% endif %}
{% comment %} Link next page {% endcomment %}
{% if paginator.next_page %}
<li><a href="{{ base_path }}/page{{ paginator.next_page }}/">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</a></li>
<li><a href="{{ '/page' | absolute_url }}{{ paginator.next_page }}/">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</a></li>
{% else %}
<li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</span></a></li>
{% endif %}

View file

@ -2,8 +2,6 @@
layout: archive
---
{% include base_path %}
<h3 class="archive__subtitle">{{ site.data.ui-text[site.locale].recent_posts | default: "Recent Posts" }}</h3>
{% for post in paginator.posts %}

View file

@ -1,6 +1,5 @@
{% if site.comments.discourse.server %}
{% include base_path %}
{% capture canonical %}{{ base_path }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' | strip_slash }}{% endif %}{% endcapture %}
{% capture canonical %}{% if site.permalink contains '.html' %}{{ page.url | absolute_url }}{% else %}{{ page.url | absolute_url | remove:'index.html' | strip_slash }}{% endif %}{% endcapture %}
<script type="text/javascript">
DiscourseEmbed = { discourseUrl: '//{{ site.comments.discourse.server }}/',
discourseEmbedUrl: '{{ canonical }}' };

View file

@ -54,12 +54,12 @@
{% if paginator.page == paginator.total_pages %}
<li><a href="#" class="disabled current">{{ paginator.page }}</a></li>
{% else %}
<li><a href="{{ base_path }}/page{{ paginator.total_pages }}/">{{ paginator.total_pages }}</a></li>
<li><a href="{{ '/page' | absolute_url }}{{ paginator.total_pages }}/">{{ paginator.total_pages }}</a></li>
{% endif %}
{% comment %} Link next page {% endcomment %}
{% if paginator.next_page %}
<li><a href="{{ base_path }}/page{{ paginator.next_page }}/">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</a></li>
<li><a href="{{ '/page' | absolute_url }}{{ paginator.next_page }}/">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</a></li>
{% else %}
<li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</span></a></li>
{% endif %}

View file

@ -2,8 +2,6 @@
layout: archive
---
{% include base_path %}
<h3 class="archive__subtitle">{{ site.data.ui-text[site.locale].recent_posts | default: "Recent Posts" }}</h3>
{% for post in paginator.posts %}

View file

@ -213,7 +213,6 @@ Still sticking with science and Isaac Newton's E = MC<sup>2</sup>, which should
This allows you to denote <var>variables</var>.
{% include base_path %}
{% for post in site.pages %}
{% include archive-single.html %}
{% endfor %}

View file

@ -5,7 +5,7 @@ permalink: /sitemap/
author_profile: false
---
A list of all the posts and pages found on the site. For you robots out there is an [XML version]({{ base_path }}/sitemap.xml) available for digesting as well.
A list of all the posts and pages found on the site. For you robots out there is an [XML version]({{ "sitemap.xml" | absolute_url }}) available for digesting as well.
<h2>Pages</h2>
{% for post in site.pages %}

View file

@ -7,10 +7,8 @@ tags:
- Post Formats
---
{% include base_path %}
{% capture fig_img %}
![Foo]({{ basepath }}/assets/images/unsplash-gallery-image-3.jpg)
![Foo]({{ "/assets/images/unsplash-gallery-image-3.jpg" | absolute_url }})
{% endcapture %}
<figure>