~xdavidwu/xdavidwu.link

8481dd43dcff48d281f61fc9d2b10c7bebc2bd84 — Michael Rose 6 years ago ed92b4c
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
M CHANGELOG.md => CHANGELOG.md +6 -0
@@ 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

M _includes/archive-single.html => _includes/archive-single.html +3 -3
@@ 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 %}

M _includes/author-profile.html => _includes/author-profile.html +2 -2
@@ 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">

M _includes/breadcrumbs.html => _includes/breadcrumbs.html +1 -1
@@ 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>

M _includes/category-list.html => _includes/category-list.html +1 -1
@@ 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>

M _includes/feature_row => _includes/feature_row +2 -2
@@ 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>

M _includes/figure => _includes/figure +1 -1
@@ 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 %}

M _includes/footer.html => _includes/footer.html +1 -1
@@ 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>


M _includes/gallery => _includes/gallery +3 -3
@@ 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 %}

M _includes/head.html => _includes/head.html +3 -3
@@ 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 %}

M _includes/masthead.html => _includes/masthead.html +1 -1
@@ 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' %}

M _includes/page__hero.html => _includes/page__hero.html +3 -3
@@ 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" %}

M _includes/paginator.html => _includes/paginator.html +6 -6
@@ 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 %}

M _includes/post_pagination.html => _includes/post_pagination.html +2 -2
@@ 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 %}

M _includes/scripts.html => _includes/scripts.html +2 -2
@@ 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 %}


M _includes/search/lunr-search-scripts.html => _includes/search/lunr-search-scripts.html +3 -3
@@ 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>
\ No newline at end of file
<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>
\ No newline at end of file

M _includes/sidebar.html => _includes/sidebar.html +1 -1
@@ 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 %}

M _includes/tag-list.html => _includes/tag-list.html +1 -1
@@ 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>