Skip to content

Commit c8226a3

Browse files
committedMar 20, 2018
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 mmistakes#1588
1 parent fbb7356 commit c8226a3

19 files changed

+49
-37
lines changed
 

‎CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
## Unreleased
22

3+
### Enhancements
4+
35
* Add default `theme` and `remote_theme` values to `_config.yml`.
46

7+
### Bug Fixes
8+
9+
* Replace `absolute_url` filter with `relative_url` where it makes sense (asset/nagivation related paths). [#1588](https://github.com/mmistakes/minimal-mistakes/issues/1588)
10+
511
## [4.10.1](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.10.1)
612

713
### Enhancements

‎_includes/archive-single.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
{% if teaser contains "://" %}
1919
"{{ teaser }}"
2020
{% else %}
21-
"{{ teaser | absolute_url }}"
21+
"{{ teaser | relative_url }}"
2222
{% endif %}
2323
alt="">
2424
</div>
2525
{% endif %}
2626
<h2 class="archive__item-title" itemprop="headline">
2727
{% if post.link %}
28-
<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>
28+
<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>
2929
{% else %}
30-
<a href="{{ post.url | absolute_url }}" rel="permalink">{{ title }}</a>
30+
<a href="{{ post.url | relative_url }}" rel="permalink">{{ title }}</a>
3131
{% endif %}
3232
</h2>
3333
{% if post.read_time %}

‎_includes/author-profile.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
{% if author.avatar contains "://" %}
99
{% assign author_src = author.avatar %}
1010
{% else %}
11-
{% assign author_src = author.avatar | absolute_url %}
11+
{% assign author_src = author.avatar | relative_url %}
1212
{% endif %}
1313

1414
{% if author.home %}
1515
{% if author.home contains "://" %}
1616
{% assign author_link = author.home %}
1717
{% else %}
18-
{% assign author_link = author.home | absolute_url %}
18+
{% assign author_link = author.home | relative_url %}
1919
{% endif %}
2020
<a href="{{ author_link }}">
2121
<img src="{{ author_src }}" alt="{{ author.name }}" itemprop="image">

‎_includes/breadcrumbs.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
{% else %}
3030
{% assign i = i | plus: 1 %}
3131
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
32-
<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>
32+
<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>
3333
<meta itemprop="position" content="{{ i }}" />
3434
</li>
3535
<span class="sep">{{ site.data.ui-text[site.locale].breadcrumb_separator | default: "/" }}</span>

‎_includes/category-list.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{% for hash in category_hashes %}
2020
{% assign keyValue = hash | split: '#' %}
2121
{% capture category_word %}{{ keyValue[1] | strip_newlines }}{% endcapture %}
22-
<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 %}
22+
<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 %}
2323
{% endfor %}
2424
</span>
2525
</p>

‎_includes/feature_row

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{% if f.url contains "://" %}
1212
{% capture f_url %}{{ f.url }}{% endcapture %}
1313
{% else %}
14-
{% capture f_url %}{{ f.url | absolute_url }}{% endcapture %}
14+
{% capture f_url %}{{ f.url | relative_url }}{% endcapture %}
1515
{% endif %}
1616

1717
<div class="feature__item{% if include.type %}--{{ include.type }}{% endif %}">
@@ -22,7 +22,7 @@
2222
{% if f.image_path contains "://" %}
2323
"{{ f.image_path }}"
2424
{% else %}
25-
"{{ f.image_path | absolute_url }}"
25+
"{{ f.image_path | relative_url }}"
2626
{% endif %}
2727
alt="{% if f.alt %}{{ f.alt }}{% endif %}">
2828
</div>

‎_includes/figure

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% if include.image_path contains "://" %}
44
"{{ include.image_path }}"
55
{% else %}
6-
"{{ include.image_path | absolute_url }}"
6+
"{{ include.image_path | relative_url }}"
77
{% endif %}
88
alt="{% if include.alt %}{{ include.alt }}{% endif %}">
99
{% if include.caption %}

‎_includes/footer.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{% if site.author.bitbucket %}
1919
<li><a href="https://bitbucket.org/{{ site.author.bitbucket }}"><i class="fab fa-fw fa-bitbucket" aria-hidden="true"></i> Bitbucket</a></li>
2020
{% endif %}
21-
<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>
21+
<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>
2222
</ul>
2323
</div>
2424

‎_includes/gallery

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
{% if img.url contains "://" %}
2020
"{{ img.url }}"
2121
{% else %}
22-
"{{ img.url | absolute_url }}"
22+
"{{ img.url | relative_url }}"
2323
{% endif %}
2424
{% if img.title %}title="{{ img.title }}"{% endif %}
2525
>
2626
<img src=
2727
{% if img.image_path contains "://" %}
2828
"{{ img.image_path }}"
2929
{% else %}
30-
"{{ img.image_path | absolute_url }}"
30+
"{{ img.image_path | relative_url }}"
3131
{% endif %}
3232
alt="{% if img.alt %}{{ img.alt }}{% endif %}">
3333
</a>
@@ -36,7 +36,7 @@
3636
{% if img.image_path contains "://" %}
3737
"{{ img.image_path }}"
3838
{% else %}
39-
"{{ img.image_path | absolute_url }}"
39+
"{{ img.image_path | relative_url }}"
4040
{% endif %}
4141
alt="{% if img.alt %}{{ img.alt }}{% endif %}">
4242
{% endif %}

‎_includes/head.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{% include seo.html %}
44

5-
<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">
5+
<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">
66

77
<!-- http://t.co/dKP3o1e -->
88
<meta name="HandheldFriendly" content="True">
@@ -14,7 +14,7 @@
1414
</script>
1515

1616
<!-- For all browsers -->
17-
<link rel="stylesheet" href="{{ '/assets/css/main.css' | absolute_url }}">
17+
<link rel="stylesheet" href="{{ '/assets/css/main.css' | relative_url }}">
1818

1919
<!--[if lte IE 9]>
2020
<style>
@@ -36,7 +36,7 @@
3636
{% if script contains "://" %}
3737
{% capture script_path %}{{ script }}{% endcapture %}
3838
{% else %}
39-
{% capture script_path %}{{ script | absolute_url }}{% endcapture %}
39+
{% capture script_path %}{{ script | relative_url }}{% endcapture %}
4040
{% endif %}
4141
<script src="{{ script_path }}"></script>
4242
{% endfor %}

‎_includes/masthead.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="masthead__inner-wrap">
33
<div class="masthead__menu">
44
<nav id="site-nav" class="greedy-nav">
5-
<a class="site-title" href="{{ '/' | absolute_url }}">{{ site.title }}</a>
5+
<a class="site-title" href="{{ '/' | relative_url }}">{{ site.title }}</a>
66
<ul class="visible-links">
77
{% for link in site.data.navigation.main %}
88
{% if link.url contains 'http' %}

‎_includes/page__hero.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{% if page.header.image contains "://" %}
22
{% capture img_path %}{{ page.header.image }}{% endcapture %}
33
{% else %}
4-
{% capture img_path %}{{ page.header.image | absolute_url }}{% endcapture %}
4+
{% capture img_path %}{{ page.header.image | relative_url }}{% endcapture %}
55
{% endif %}
66

77
{% if page.header.cta_url contains "://" %}
88
{% capture cta_path %}{{ page.header.cta_url }}{% endcapture %}
99
{% else %}
10-
{% capture cta_path %}{{ page.header.cta_url | absolute_url }}{% endcapture %}
10+
{% capture cta_path %}{{ page.header.cta_url | relative_url }}{% endcapture %}
1111
{% endif %}
1212

1313
{% if page.header.overlay_image contains "://" %}
1414
{% capture overlay_img_path %}{{ page.header.overlay_image }}{% endcapture %}
1515
{% elsif page.header.overlay_image %}
16-
{% capture overlay_img_path %}{{ page.header.overlay_image | absolute_url }}{% endcapture %}
16+
{% capture overlay_img_path %}{{ page.header.overlay_image | relative_url }}{% endcapture %}
1717
{% endif %}
1818

1919
{% if page.header.overlay_filter contains "rgba" %}

‎_includes/paginator.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{% if paginator.total_pages > 1 %}
22
<nav class="pagination">
3-
{% assign first_page_path = site.paginate_path | replace: 'page:num', '' | replace: '//', '/' | absolute_url %}
3+
{% assign first_page_path = site.paginate_path | replace: 'page:num', '' | replace: '//', '/' | relative_url %}
44
<ul>
55
{% comment %} Link for previous page {% endcomment %}
66
{% if paginator.previous_page %}
77
{% if paginator.previous_page == 1 %}
88
<li><a href="{{ first_page_path }}">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a></li>
99
{% else %}
10-
<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>
10+
<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>
1111
{% endif %}
1212
{% else %}
1313
<li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</span></a></li>
@@ -35,15 +35,15 @@
3535

3636
{% for index in (page_start..page_end) %}
3737
{% if index == paginator.page %}
38-
<li><a href="{{ site.paginate_path | replace: ':num', index | replace: '//', '/' | absolute_url }}" class="disabled current">{{ index }}</a></li>
38+
<li><a href="{{ site.paginate_path | replace: ':num', index | replace: '//', '/' | relative_url }}" class="disabled current">{{ index }}</a></li>
3939
{% else %}
4040
{% comment %} Distance from current page and this link {% endcomment %}
4141
{% assign dist = paginator.page | minus: index %}
4242
{% if dist < 0 %}
4343
{% comment %} Distance must be a positive value {% endcomment %}
4444
{% assign dist = 0 | minus: dist %}
4545
{% endif %}
46-
<li><a href="{{ site.paginate_path | replace: ':num', index | absolute_url }}">{{ index }}</a></li>
46+
<li><a href="{{ site.paginate_path | replace: ':num', index | relative_url }}">{{ index }}</a></li>
4747
{% endif %}
4848
{% endfor %}
4949

@@ -55,12 +55,12 @@
5555
{% if paginator.page == paginator.total_pages %}
5656
<li><a href="#" class="disabled current">{{ paginator.page }}</a></li>
5757
{% else %}
58-
<li><a href="{{ site.paginate_path | replace: ':num', paginator.total_pages | replace: '//', '/' | absolute_url }}">{{ paginator.total_pages }}</a></li>
58+
<li><a href="{{ site.paginate_path | replace: ':num', paginator.total_pages | replace: '//', '/' | relative_url }}">{{ paginator.total_pages }}</a></li>
5959
{% endif %}
6060

6161
{% comment %} Link next page {% endcomment %}
6262
{% if paginator.next_page %}
63-
<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>
63+
<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>
6464
{% else %}
6565
<li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</span></a></li>
6666
{% endif %}

‎_includes/post_pagination.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{% if page.previous or page.next %}
22
<nav class="pagination">
33
{% if page.previous %}
4-
<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>
4+
<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>
55
{% else %}
66
<a href="#" class="pagination--pager disabled">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a>
77
{% endif %}
88
{% if page.next %}
9-
<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>
9+
<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>
1010
{% else %}
1111
<a href="#" class="pagination--pager disabled">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</a>
1212
{% endif %}

‎_includes/scripts.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
{% if script contains "://" %}
44
{% capture script_path %}{{ script }}{% endcapture %}
55
{% else %}
6-
{% capture script_path %}{{ script | absolute_url }}{% endcapture %}
6+
{% capture script_path %}{{ script | relative_url }}{% endcapture %}
77
{% endif %}
88
<script src="{{ script_path }}"></script>
99
{% endfor %}
1010
{% else %}
11-
<script src="{{ '/assets/js/main.min.js' | absolute_url }}"></script>
11+
<script src="{{ '/assets/js/main.min.js' | relative_url }}"></script>
1212
<script src="https://use.fontawesome.com/releases/v5.0.8/js/all.js"></script>
1313
{% endif %}
1414

‎_includes/search/lunr-search-scripts.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
{% else %}
66
{% assign lang = "en" %}
77
{% endcase %}
8-
<script src="{{ '/assets/js/lunr/lunr.min.js' | absolute_url }}"></script>
9-
<script src="{{ '/assets/js/lunr/lunr-store.js' | absolute_url }}"></script>
10-
<script src="{{ '/assets/js/lunr/lunr-' | append: lang | append: '.js' | absolute_url }}"></script>
8+
<script src="{{ '/assets/js/lunr/lunr.min.js' | relative_url }}"></script>
9+
<script src="{{ '/assets/js/lunr/lunr-store.js' | relative_url }}"></script>
10+
<script src="{{ '/assets/js/lunr/lunr-' | append: lang | append: '.js' | relative_url }}"></script>

‎_includes/sidebar.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{% if s.image contains "://" %}
99
"{{ s.image }}"
1010
{% else %}
11-
"{{ s.image | absolute_url }}"
11+
"{{ s.image | relative_url }}"
1212
{% endif %}
1313
alt="{% if s.image_alt %}{{ s.image_alt }}{% endif %}">
1414
{% endif %}

‎_includes/tag-list.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{% for hash in tag_hashes %}
2020
{% assign keyValue = hash | split: '#' %}
2121
{% capture tag_word %}{{ keyValue[1] | strip_newlines }}{% endcapture %}
22-
<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 %}
22+
<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 %}
2323
{% endfor %}
2424
</span>
2525
</p>

‎docs/_docs/18-history.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,20 @@ permalink: /docs/history/
44
excerpt: "Change log of enhancements and bug fixes made to the theme."
55
sidebar:
66
nav: docs
7-
last_modified_at: 2018-03-14T12:54:07-04:00
7+
last_modified_at: 2018-03-20T11:35:28-04:00
88
toc: true
99
---
1010

1111
## Unreleased
1212

13+
### Enhancements
14+
1315
* Add default `theme` and `remote_theme` values to `_config.yml`.
1416

17+
### Bug Fixes
18+
19+
* Replace `absolute_url` filter with `relative_url` where it makes sense (asset/nagivation related paths). [#1588](https://github.com/mmistakes/minimal-mistakes/issues/1588)
20+
1521
## [4.10.1](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.10.1)
1622

1723
### Enhancements

0 commit comments

Comments
 (0)
Please sign in to comment.