Replace absolute_url
with relative_url
Where it makes sense replace asset paths and navigation related paths with `relative_url` filter. Leave SEO related `<head>` elements and social sharing links as `absolute_url`. Fixes #1588
This commit is contained in:
parent
fbb7356d74
commit
c8226a32a6
19 changed files with 49 additions and 37 deletions
|
@ -1,7 +1,13 @@
|
|||
## Unreleased
|
||||
|
||||
### Enhancements
|
||||
|
||||
* Add default `theme` and `remote_theme` values to `_config.yml`.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Replace `absolute_url` filter with `relative_url` where it makes sense (asset/nagivation related paths). [#1588](https://github.com/mmistakes/minimal-mistakes/issues/1588)
|
||||
|
||||
## [4.10.1](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.10.1)
|
||||
|
||||
### Enhancements
|
||||
|
|
|
@ -18,16 +18,16 @@
|
|||
{% if teaser contains "://" %}
|
||||
"{{ teaser }}"
|
||||
{% else %}
|
||||
"{{ teaser | absolute_url }}"
|
||||
"{{ teaser | relative_url }}"
|
||||
{% endif %}
|
||||
alt="">
|
||||
</div>
|
||||
{% endif %}
|
||||
<h2 class="archive__item-title" itemprop="headline">
|
||||
{% if post.link %}
|
||||
<a href="{{ post.link }}">{{ title }}</a> <a href="{{ post.url | absolute_url }}" rel="permalink"><i class="fas fa-link" aria-hidden="true" title="permalink"></i><span class="sr-only">Permalink</span></a>
|
||||
<a href="{{ post.link }}">{{ title }}</a> <a href="{{ post.url | relative_url }}" rel="permalink"><i class="fas fa-link" aria-hidden="true" title="permalink"></i><span class="sr-only">Permalink</span></a>
|
||||
{% else %}
|
||||
<a href="{{ post.url | absolute_url }}" rel="permalink">{{ title }}</a>
|
||||
<a href="{{ post.url | relative_url }}" rel="permalink">{{ title }}</a>
|
||||
{% endif %}
|
||||
</h2>
|
||||
{% if post.read_time %}
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
{% if author.avatar contains "://" %}
|
||||
{% assign author_src = author.avatar %}
|
||||
{% else %}
|
||||
{% assign author_src = author.avatar | absolute_url %}
|
||||
{% assign author_src = author.avatar | relative_url %}
|
||||
{% endif %}
|
||||
|
||||
{% if author.home %}
|
||||
{% if author.home contains "://" %}
|
||||
{% assign author_link = author.home %}
|
||||
{% else %}
|
||||
{% assign author_link = author.home | absolute_url %}
|
||||
{% assign author_link = author.home | relative_url %}
|
||||
{% endif %}
|
||||
<a href="{{ author_link }}">
|
||||
<img src="{{ author_src }}" alt="{{ author.name }}" itemprop="image">
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
{% else %}
|
||||
{% assign i = i | plus: 1 %}
|
||||
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
|
||||
<a href="{{ crumb | downcase | replace: '%20', '-' | prepend: path_type | prepend: crumb_path | absolute_url }}" itemprop="item"><span itemprop="name">{{ crumb | replace: '-', ' ' | replace: '%20', ' ' | capitalize }}</span></a>
|
||||
<a href="{{ crumb | downcase | replace: '%20', '-' | prepend: path_type | prepend: crumb_path | relative_url }}" itemprop="item"><span itemprop="name">{{ crumb | replace: '-', ' ' | replace: '%20', ' ' | capitalize }}</span></a>
|
||||
<meta itemprop="position" content="{{ i }}" />
|
||||
</li>
|
||||
<span class="sep">{{ site.data.ui-text[site.locale].breadcrumb_separator | default: "/" }}</span>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
{% for hash in category_hashes %}
|
||||
{% assign keyValue = hash | split: '#' %}
|
||||
{% capture category_word %}{{ keyValue[1] | strip_newlines }}{% endcapture %}
|
||||
<a href="{{ category_word | slugify | prepend: path_type | prepend: site.category_archive.path | absolute_url }}" class="page__taxonomy-item" rel="tag">{{ category_word }}</a>{% unless forloop.last %}<span class="sep">, </span>{% endunless %}
|
||||
<a href="{{ category_word | slugify | prepend: path_type | prepend: site.category_archive.path | relative_url }}" class="page__taxonomy-item" rel="tag">{{ category_word }}</a>{% unless forloop.last %}<span class="sep">, </span>{% endunless %}
|
||||
{% endfor %}
|
||||
</span>
|
||||
</p>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
{% if f.url contains "://" %}
|
||||
{% capture f_url %}{{ f.url }}{% endcapture %}
|
||||
{% else %}
|
||||
{% capture f_url %}{{ f.url | absolute_url }}{% endcapture %}
|
||||
{% capture f_url %}{{ f.url | relative_url }}{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
<div class="feature__item{% if include.type %}--{{ include.type }}{% endif %}">
|
||||
|
@ -22,7 +22,7 @@
|
|||
{% if f.image_path contains "://" %}
|
||||
"{{ f.image_path }}"
|
||||
{% else %}
|
||||
"{{ f.image_path | absolute_url }}"
|
||||
"{{ f.image_path | relative_url }}"
|
||||
{% endif %}
|
||||
alt="{% if f.alt %}{{ f.alt }}{% endif %}">
|
||||
</div>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{% if include.image_path contains "://" %}
|
||||
"{{ include.image_path }}"
|
||||
{% else %}
|
||||
"{{ include.image_path | absolute_url }}"
|
||||
"{{ include.image_path | relative_url }}"
|
||||
{% endif %}
|
||||
alt="{% if include.alt %}{{ include.alt }}{% endif %}">
|
||||
{% if include.caption %}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
{% if site.author.bitbucket %}
|
||||
<li><a href="https://bitbucket.org/{{ site.author.bitbucket }}"><i class="fab fa-fw fa-bitbucket" aria-hidden="true"></i> Bitbucket</a></li>
|
||||
{% endif %}
|
||||
<li><a href="{% if site.atom_feed.path %}{{ site.atom_feed.path }}{% else %}{{ '/feed.xml' | absolute_url }}{% endif %}"><i class="fas fa-fw fa-rss-square" aria-hidden="true"></i> {{ site.data.ui-text[site.locale].feed_label | default: "Feed" }}</a></li>
|
||||
<li><a href="{% if site.atom_feed.path %}{{ site.atom_feed.path }}{% else %}{{ '/feed.xml' | relative_url }}{% endif %}"><i class="fas fa-fw fa-rss-square" aria-hidden="true"></i> {{ site.data.ui-text[site.locale].feed_label | default: "Feed" }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
{% if img.url contains "://" %}
|
||||
"{{ img.url }}"
|
||||
{% else %}
|
||||
"{{ img.url | absolute_url }}"
|
||||
"{{ img.url | relative_url }}"
|
||||
{% endif %}
|
||||
{% if img.title %}title="{{ img.title }}"{% endif %}
|
||||
>
|
||||
|
@ -27,7 +27,7 @@
|
|||
{% if img.image_path contains "://" %}
|
||||
"{{ img.image_path }}"
|
||||
{% else %}
|
||||
"{{ img.image_path | absolute_url }}"
|
||||
"{{ img.image_path | relative_url }}"
|
||||
{% endif %}
|
||||
alt="{% if img.alt %}{{ img.alt }}{% endif %}">
|
||||
</a>
|
||||
|
@ -36,7 +36,7 @@
|
|||
{% if img.image_path contains "://" %}
|
||||
"{{ img.image_path }}"
|
||||
{% else %}
|
||||
"{{ img.image_path | absolute_url }}"
|
||||
"{{ img.image_path | relative_url }}"
|
||||
{% endif %}
|
||||
alt="{% if img.alt %}{{ img.alt }}{% endif %}">
|
||||
{% endif %}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
{% include seo.html %}
|
||||
|
||||
<link href="{% if site.atom_feed.path %}{{ site.atom_feed.path }}{% else %}{{ '/feed.xml' | absolute_url }}{% endif %}" type="application/atom+xml" rel="alternate" title="{{ site.title }} Feed">
|
||||
<link href="{% if site.atom_feed.path %}{{ site.atom_feed.path }}{% else %}{{ '/feed.xml' | relative_url }}{% endif %}" type="application/atom+xml" rel="alternate" title="{{ site.title }} Feed">
|
||||
|
||||
<!-- http://t.co/dKP3o1e -->
|
||||
<meta name="HandheldFriendly" content="True">
|
||||
|
@ -14,7 +14,7 @@
|
|||
</script>
|
||||
|
||||
<!-- For all browsers -->
|
||||
<link rel="stylesheet" href="{{ '/assets/css/main.css' | absolute_url }}">
|
||||
<link rel="stylesheet" href="{{ '/assets/css/main.css' | relative_url }}">
|
||||
|
||||
<!--[if lte IE 9]>
|
||||
<style>
|
||||
|
@ -36,7 +36,7 @@
|
|||
{% if script contains "://" %}
|
||||
{% capture script_path %}{{ script }}{% endcapture %}
|
||||
{% else %}
|
||||
{% capture script_path %}{{ script | absolute_url }}{% endcapture %}
|
||||
{% capture script_path %}{{ script | relative_url }}{% endcapture %}
|
||||
{% endif %}
|
||||
<script src="{{ script_path }}"></script>
|
||||
{% endfor %}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="masthead__inner-wrap">
|
||||
<div class="masthead__menu">
|
||||
<nav id="site-nav" class="greedy-nav">
|
||||
<a class="site-title" href="{{ '/' | absolute_url }}">{{ site.title }}</a>
|
||||
<a class="site-title" href="{{ '/' | relative_url }}">{{ site.title }}</a>
|
||||
<ul class="visible-links">
|
||||
{% for link in site.data.navigation.main %}
|
||||
{% if link.url contains 'http' %}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
{% if page.header.image contains "://" %}
|
||||
{% capture img_path %}{{ page.header.image }}{% endcapture %}
|
||||
{% else %}
|
||||
{% capture img_path %}{{ page.header.image | absolute_url }}{% endcapture %}
|
||||
{% capture img_path %}{{ page.header.image | relative_url }}{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if page.header.cta_url contains "://" %}
|
||||
{% capture cta_path %}{{ page.header.cta_url }}{% endcapture %}
|
||||
{% else %}
|
||||
{% capture cta_path %}{{ page.header.cta_url | absolute_url }}{% endcapture %}
|
||||
{% capture cta_path %}{{ page.header.cta_url | relative_url }}{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if page.header.overlay_image contains "://" %}
|
||||
{% capture overlay_img_path %}{{ page.header.overlay_image }}{% endcapture %}
|
||||
{% elsif page.header.overlay_image %}
|
||||
{% capture overlay_img_path %}{{ page.header.overlay_image | absolute_url }}{% endcapture %}
|
||||
{% capture overlay_img_path %}{{ page.header.overlay_image | relative_url }}{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if page.header.overlay_filter contains "rgba" %}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{% if paginator.total_pages > 1 %}
|
||||
<nav class="pagination">
|
||||
{% assign first_page_path = site.paginate_path | replace: 'page:num', '' | replace: '//', '/' | absolute_url %}
|
||||
{% assign first_page_path = site.paginate_path | replace: 'page:num', '' | replace: '//', '/' | relative_url %}
|
||||
<ul>
|
||||
{% comment %} Link for previous page {% endcomment %}
|
||||
{% if paginator.previous_page %}
|
||||
{% if paginator.previous_page == 1 %}
|
||||
<li><a href="{{ first_page_path }}">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a></li>
|
||||
{% else %}
|
||||
<li><a href="{{ site.paginate_path | replace: ':num', paginator.previous_page | replace: '//', '/' | absolute_url }}">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a></li>
|
||||
<li><a href="{{ site.paginate_path | replace: ':num', paginator.previous_page | replace: '//', '/' | relative_url }}">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a></li>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</span></a></li>
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
{% for index in (page_start..page_end) %}
|
||||
{% if index == paginator.page %}
|
||||
<li><a href="{{ site.paginate_path | replace: ':num', index | replace: '//', '/' | absolute_url }}" class="disabled current">{{ index }}</a></li>
|
||||
<li><a href="{{ site.paginate_path | replace: ':num', index | replace: '//', '/' | relative_url }}" class="disabled current">{{ index }}</a></li>
|
||||
{% else %}
|
||||
{% comment %} Distance from current page and this link {% endcomment %}
|
||||
{% assign dist = paginator.page | minus: index %}
|
||||
|
@ -43,7 +43,7 @@
|
|||
{% comment %} Distance must be a positive value {% endcomment %}
|
||||
{% assign dist = 0 | minus: dist %}
|
||||
{% endif %}
|
||||
<li><a href="{{ site.paginate_path | replace: ':num', index | absolute_url }}">{{ index }}</a></li>
|
||||
<li><a href="{{ site.paginate_path | replace: ':num', index | relative_url }}">{{ index }}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
|
@ -55,12 +55,12 @@
|
|||
{% if paginator.page == paginator.total_pages %}
|
||||
<li><a href="#" class="disabled current">{{ paginator.page }}</a></li>
|
||||
{% else %}
|
||||
<li><a href="{{ site.paginate_path | replace: ':num', paginator.total_pages | replace: '//', '/' | absolute_url }}">{{ paginator.total_pages }}</a></li>
|
||||
<li><a href="{{ site.paginate_path | replace: ':num', paginator.total_pages | replace: '//', '/' | relative_url }}">{{ paginator.total_pages }}</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% comment %} Link next page {% endcomment %}
|
||||
{% if paginator.next_page %}
|
||||
<li><a href="{{ site.paginate_path | replace: ':num', paginator.next_page | replace: '//', '/' | absolute_url }}">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</a></li>
|
||||
<li><a href="{{ site.paginate_path | replace: ':num', paginator.next_page | replace: '//', '/' | relative_url }}">{{ 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 %}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{% if page.previous or page.next %}
|
||||
<nav class="pagination">
|
||||
{% if page.previous %}
|
||||
<a href="{{ page.previous.url | absolute_url }}" class="pagination--pager" title="{{ page.previous.title | markdownify | strip_html }}">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a>
|
||||
<a href="{{ page.previous.url | relative_url }}" class="pagination--pager" title="{{ page.previous.title | markdownify | strip_html }}">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a>
|
||||
{% else %}
|
||||
<a href="#" class="pagination--pager disabled">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a>
|
||||
{% endif %}
|
||||
{% if page.next %}
|
||||
<a href="{{ page.next.url | absolute_url }}" class="pagination--pager" title="{{ page.next.title | markdownify | strip_html }}">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</a>
|
||||
<a href="{{ page.next.url | relative_url }}" class="pagination--pager" title="{{ page.next.title | markdownify | strip_html }}">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</a>
|
||||
{% else %}
|
||||
<a href="#" class="pagination--pager disabled">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</a>
|
||||
{% endif %}
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
{% if script contains "://" %}
|
||||
{% capture script_path %}{{ script }}{% endcapture %}
|
||||
{% else %}
|
||||
{% capture script_path %}{{ script | absolute_url }}{% endcapture %}
|
||||
{% capture script_path %}{{ script | relative_url }}{% endcapture %}
|
||||
{% endif %}
|
||||
<script src="{{ script_path }}"></script>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<script src="{{ '/assets/js/main.min.js' | absolute_url }}"></script>
|
||||
<script src="{{ '/assets/js/main.min.js' | relative_url }}"></script>
|
||||
<script src="https://use.fontawesome.com/releases/v5.0.8/js/all.js"></script>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
{% else %}
|
||||
{% assign lang = "en" %}
|
||||
{% endcase %}
|
||||
<script src="{{ '/assets/js/lunr/lunr.min.js' | absolute_url }}"></script>
|
||||
<script src="{{ '/assets/js/lunr/lunr-store.js' | absolute_url }}"></script>
|
||||
<script src="{{ '/assets/js/lunr/lunr-' | append: lang | append: '.js' | absolute_url }}"></script>
|
||||
<script src="{{ '/assets/js/lunr/lunr.min.js' | relative_url }}"></script>
|
||||
<script src="{{ '/assets/js/lunr/lunr-store.js' | relative_url }}"></script>
|
||||
<script src="{{ '/assets/js/lunr/lunr-' | append: lang | append: '.js' | relative_url }}"></script>
|
|
@ -8,7 +8,7 @@
|
|||
{% if s.image contains "://" %}
|
||||
"{{ s.image }}"
|
||||
{% else %}
|
||||
"{{ s.image | absolute_url }}"
|
||||
"{{ s.image | relative_url }}"
|
||||
{% endif %}
|
||||
alt="{% if s.image_alt %}{{ s.image_alt }}{% endif %}">
|
||||
{% endif %}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
{% for hash in tag_hashes %}
|
||||
{% assign keyValue = hash | split: '#' %}
|
||||
{% capture tag_word %}{{ keyValue[1] | strip_newlines }}{% endcapture %}
|
||||
<a href="{{ tag_word | slugify | prepend: path_type | prepend: site.tag_archive.path | absolute_url }}" class="page__taxonomy-item" rel="tag">{{ tag_word }}</a>{% unless forloop.last %}<span class="sep">, </span>{% endunless %}
|
||||
<a href="{{ tag_word | slugify | prepend: path_type | prepend: site.tag_archive.path | relative_url }}" class="page__taxonomy-item" rel="tag">{{ tag_word }}</a>{% unless forloop.last %}<span class="sep">, </span>{% endunless %}
|
||||
{% endfor %}
|
||||
</span>
|
||||
</p>
|
||||
|
|
|
@ -4,14 +4,20 @@ permalink: /docs/history/
|
|||
excerpt: "Change log of enhancements and bug fixes made to the theme."
|
||||
sidebar:
|
||||
nav: docs
|
||||
last_modified_at: 2018-03-14T12:54:07-04:00
|
||||
last_modified_at: 2018-03-20T11:35:28-04:00
|
||||
toc: true
|
||||
---
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Enhancements
|
||||
|
||||
* Add default `theme` and `remote_theme` values to `_config.yml`.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Replace `absolute_url` filter with `relative_url` where it makes sense (asset/nagivation related paths). [#1588](https://github.com/mmistakes/minimal-mistakes/issues/1588)
|
||||
|
||||
## [4.10.1](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.10.1)
|
||||
|
||||
### Enhancements
|
||||
|
|
Loading…
Reference in a new issue