Use relative_url and absolute_url where possible (#2387)
* Use relative_url and absolute_url where possible Drops the `contains "://"` check, adopt Jekyll 3.7 Ref: https://github.com/mmistakes/minimal-mistakes/pull/2385#issuecomment-579882236 * One more unneeded {% assign %} * Remove one more assign as noted by mmistakes * Consolidate 4 more captures * Consolidate an extra assign on "active" class
This commit is contained in:
parent
0cf1a2e114
commit
bcd6126612
13 changed files with 39 additions and 168 deletions
|
@ -14,13 +14,7 @@
|
||||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||||
{% if include.type == "grid" and teaser %}
|
{% if include.type == "grid" and teaser %}
|
||||||
<div class="archive__item-teaser">
|
<div class="archive__item-teaser">
|
||||||
<img src=
|
<img src="{{ teaser | relative_url }}" alt="">
|
||||||
{% if teaser contains "://" %}
|
|
||||||
"{{ teaser }}"
|
|
||||||
{% else %}
|
|
||||||
"{{ teaser | relative_url }}"
|
|
||||||
{% endif %}
|
|
||||||
alt="">
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h2 class="archive__item-title" itemprop="headline">
|
<h2 class="archive__item-title" itemprop="headline">
|
||||||
|
|
|
@ -5,23 +5,12 @@
|
||||||
|
|
||||||
{% if author.avatar %}
|
{% if author.avatar %}
|
||||||
<div class="author__avatar">
|
<div class="author__avatar">
|
||||||
{% if author.avatar contains "://" %}
|
|
||||||
{% assign author_src = author.avatar %}
|
|
||||||
{% else %}
|
|
||||||
{% assign author_src = author.avatar | relative_url %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if author.home %}
|
{% if author.home %}
|
||||||
{% if author.home contains "://" %}
|
<a href="{{ author.home | relative_url }}">
|
||||||
{% assign author_link = author.home %}
|
<img src="{{ author.avatar | relative_url }}" alt="{{ author.name }}" itemprop="image">
|
||||||
{% else %}
|
|
||||||
{% assign author_link = author.home | relative_url %}
|
|
||||||
{% endif %}
|
|
||||||
<a href="{{ author_link }}">
|
|
||||||
<img src="{{ author_src }}" alt="{{ author.name }}" itemprop="image">
|
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<img src="{{ author_src }}" alt="{{ author.name }}" itemprop="image">
|
<img src="{{ author.avatar | relative_url }}" alt="{{ author.name }}" itemprop="image">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -208,7 +197,7 @@
|
||||||
<i class="fab fa-fw fa-youtube" aria-hidden="true"></i> YouTube
|
<i class="fab fa-fw fa-youtube" aria-hidden="true"></i> YouTube
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% else author.youtube %}
|
{% elsif author.youtube %}
|
||||||
<li>
|
<li>
|
||||||
<a href="https://www.youtube.com/user/{{ author.youtube }}" itemprop="sameAs" rel="nofollow noopener noreferrer">
|
<a href="https://www.youtube.com/user/{{ author.youtube }}" itemprop="sameAs" rel="nofollow noopener noreferrer">
|
||||||
<i class="fab fa-fw fa-youtube" aria-hidden="true"></i> YouTube
|
<i class="fab fa-fw fa-youtube" aria-hidden="true"></i> YouTube
|
||||||
|
|
|
@ -7,23 +7,11 @@
|
||||||
<div class="feature__wrapper">
|
<div class="feature__wrapper">
|
||||||
|
|
||||||
{% for f in feature_row %}
|
{% for f in feature_row %}
|
||||||
|
|
||||||
{% if f.url contains "://" %}
|
|
||||||
{% capture f_url %}{{ f.url }}{% endcapture %}
|
|
||||||
{% else %}
|
|
||||||
{% capture f_url %}{{ f.url | relative_url }}{% endcapture %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div class="feature__item{% if include.type %}--{{ include.type }}{% endif %}">
|
<div class="feature__item{% if include.type %}--{{ include.type }}{% endif %}">
|
||||||
<div class="archive__item">
|
<div class="archive__item">
|
||||||
{% if f.image_path %}
|
{% if f.image_path %}
|
||||||
<div class="archive__item-teaser">
|
<div class="archive__item-teaser">
|
||||||
<img src=
|
<img src="{{ f.image_path | relative_url }}"
|
||||||
{% if f.image_path contains "://" %}
|
|
||||||
"{{ f.image_path }}"
|
|
||||||
{% else %}
|
|
||||||
"{{ f.image_path | relative_url }}"
|
|
||||||
{% endif %}
|
|
||||||
alt="{% if f.alt %}{{ f.alt }}{% endif %}">
|
alt="{% if f.alt %}{{ f.alt }}{% endif %}">
|
||||||
{% if f.image_caption %}
|
{% if f.image_caption %}
|
||||||
<span class="archive__item-caption">{{ f.image_caption | markdownify | remove: "<p>" | remove: "</p>" }}</span>
|
<span class="archive__item-caption">{{ f.image_caption | markdownify | remove: "<p>" | remove: "</p>" }}</span>
|
||||||
|
@ -43,7 +31,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if f.url %}
|
{% if f.url %}
|
||||||
<p><a href="{{ f_url }}" class="btn {{ f.btn_class }}">{{ f.btn_label | default: site.data.ui-text[site.locale].more_label | default: "Learn More" }}</a></p>
|
<p><a href="{{ f.url | relative_url }}" class="btn {{ f.btn_class }}">{{ f.btn_label | default: site.data.ui-text[site.locale].more_label | default: "Learn More" }}</a></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
<figure class="{{ include.class }}">
|
<figure class="{{ include.class }}">
|
||||||
<img src=
|
<img src="{{ include.image_path | relative_url }}"
|
||||||
{% if include.image_path contains "://" %}
|
|
||||||
"{{ include.image_path }}"
|
|
||||||
{% else %}
|
|
||||||
"{{ include.image_path | relative_url }}"
|
|
||||||
{% endif %}
|
|
||||||
alt="{% if include.alt %}{{ include.alt }}{% endif %}">
|
alt="{% if include.alt %}{{ include.alt }}{% endif %}">
|
||||||
{% if include.caption %}
|
{% if include.caption %}
|
||||||
<figcaption>
|
<figcaption>
|
||||||
{{ include.caption | markdownify | remove: "<p>" | remove: "</p>" }}
|
{{ include.caption | markdownify | remove: "<p>" | remove: "</p>" }}
|
||||||
</figcaption>{% endif %}</figure>
|
</figcaption>
|
||||||
|
{% endif %}
|
||||||
|
</figure>
|
||||||
|
|
|
@ -19,29 +19,13 @@
|
||||||
<figure class="{{ gallery_layout }} {{ include.class }}">
|
<figure class="{{ gallery_layout }} {{ include.class }}">
|
||||||
{% for img in gallery %}
|
{% for img in gallery %}
|
||||||
{% if img.url %}
|
{% if img.url %}
|
||||||
<a href=
|
<a href="{{ img.url | relative_url }}"
|
||||||
{% if img.url contains "://" %}
|
{% if img.title %}title="{{ img.title }}"{% endif %}>
|
||||||
"{{ img.url }}"
|
<img src="{{ img.image_path | relative_url }}"
|
||||||
{% else %}
|
|
||||||
"{{ img.url | relative_url }}"
|
|
||||||
{% endif %}
|
|
||||||
{% if img.title %}title="{{ img.title }}"{% endif %}
|
|
||||||
>
|
|
||||||
<img src=
|
|
||||||
{% if img.image_path contains "://" %}
|
|
||||||
"{{ img.image_path }}"
|
|
||||||
{% else %}
|
|
||||||
"{{ img.image_path | relative_url }}"
|
|
||||||
{% endif %}
|
|
||||||
alt="{% if img.alt %}{{ img.alt }}{% endif %}">
|
alt="{% if img.alt %}{{ img.alt }}{% endif %}">
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<img src=
|
<img src="{{ img.image_path | relative_url }}"
|
||||||
{% if img.image_path contains "://" %}
|
|
||||||
"{{ img.image_path }}"
|
|
||||||
{% else %}
|
|
||||||
"{{ img.image_path | relative_url }}"
|
|
||||||
{% endif %}
|
|
||||||
alt="{% if img.alt %}{{ img.alt }}{% endif %}">
|
alt="{% if img.alt %}{{ img.alt }}{% endif %}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -31,11 +31,6 @@
|
||||||
|
|
||||||
{% if site.head_scripts %}
|
{% if site.head_scripts %}
|
||||||
{% for script in site.head_scripts %}
|
{% for script in site.head_scripts %}
|
||||||
{% if script contains "://" %}
|
<script src="{{ script | relative_url }}"></script>
|
||||||
{% capture script_path %}{{ script }}{% endcapture %}
|
|
||||||
{% else %}
|
|
||||||
{% capture script_path %}{{ script | relative_url }}{% endcapture %}
|
|
||||||
{% endif %}
|
|
||||||
<script src="{{ script_path }}"></script>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -13,13 +13,8 @@
|
||||||
</a>
|
</a>
|
||||||
<ul class="visible-links">
|
<ul class="visible-links">
|
||||||
{%- for link in site.data.navigation.main -%}
|
{%- for link in site.data.navigation.main -%}
|
||||||
{%- if link.url contains '://' -%}
|
|
||||||
{%- assign url = link.url -%}
|
|
||||||
{%- else -%}
|
|
||||||
{%- assign url = link.url | relative_url -%}
|
|
||||||
{%- endif -%}
|
|
||||||
<li class="masthead__menu-item">
|
<li class="masthead__menu-item">
|
||||||
<a href="{{ url }}" {% if link.description %}title="{{ link.description }}"{% endif %}>{{ link.title }}</a>
|
<a href="{{ link.url | relative_url }}"{% if link.description %} title="{{ link.description }}"{% endif %}>{{ link.title }}</a>
|
||||||
</li>
|
</li>
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -8,14 +8,7 @@
|
||||||
{% for nav in navigation %}
|
{% for nav in navigation %}
|
||||||
<li>
|
<li>
|
||||||
{% if nav.url %}
|
{% if nav.url %}
|
||||||
{% comment %} internal/external URL check {% endcomment %}
|
<a href="{{ nav.url | relative_url }}"><span class="nav__sub-title">{{ nav.title }}</span></a>
|
||||||
{% if nav.url contains "://" %}
|
|
||||||
{% assign nav_url = nav.url %}
|
|
||||||
{% else %}
|
|
||||||
{% assign nav_url = nav.url | relative_url %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<a href="{{ nav_url }}"><span class="nav__sub-title">{{ nav.title }}</span></a>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="nav__sub-title">{{ nav.title }}</span>
|
<span class="nav__sub-title">{{ nav.title }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -23,21 +16,7 @@
|
||||||
{% if nav.children != null %}
|
{% if nav.children != null %}
|
||||||
<ul>
|
<ul>
|
||||||
{% for child in nav.children %}
|
{% for child in nav.children %}
|
||||||
{% comment %} internal/external URL check {% endcomment %}
|
<li><a href="{{ child.url | relative_url }}"{% if child.url == page.url %} class="active"{% endif %}>{{ child.title }}</a></li>
|
||||||
{% if child.url contains "://" %}
|
|
||||||
{% assign child_url = child.url %}
|
|
||||||
{% else %}
|
|
||||||
{% assign child_url = child.url | relative_url %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% comment %} set "active" class on current page {% endcomment %}
|
|
||||||
{% if child.url == page.url %}
|
|
||||||
{% assign active = "active" %}
|
|
||||||
{% else %}
|
|
||||||
{% assign active = "" %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<li><a href="{{ child_url }}" class="{{ active }}">{{ child.title }}</a></li>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,20 +1,4 @@
|
||||||
{% if page.header.image contains "://" %}
|
{% capture overlay_img_path %}{{ page.header.overlay_image | relative_url }}{% endcapture %}
|
||||||
{% capture img_path %}{{ page.header.image }}{% endcapture %}
|
|
||||||
{% else %}
|
|
||||||
{% 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 | 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 | relative_url }}{% endcapture %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if page.header.overlay_filter contains "rgba" %}
|
{% if page.header.overlay_filter contains "rgba" %}
|
||||||
{% capture overlay_filter %}{{ page.header.overlay_filter }}{% endcapture %}
|
{% capture overlay_filter %}{{ page.header.overlay_filter }}{% endcapture %}
|
||||||
|
@ -51,22 +35,17 @@
|
||||||
<p class="page__meta"><i class="far fa-clock" aria-hidden="true"></i> {% include read-time.html %}</p>
|
<p class="page__meta"><i class="far fa-clock" aria-hidden="true"></i> {% include read-time.html %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if page.header.cta_url %}
|
{% if page.header.cta_url %}
|
||||||
<p><a href="{{ cta_path }}" class="btn btn--light-outline btn--large">{{ page.header.cta_label | default: site.data.ui-text[site.locale].more_label | default: "Learn More" }}</a></p>
|
<p><a href="{{ page.header.cta_url | relative_url }}" class="btn btn--light-outline btn--large">{{ page.header.cta_label | default: site.data.ui-text[site.locale].more_label | default: "Learn More" }}</a></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if page.header.actions %}
|
{% if page.header.actions %}
|
||||||
<p>
|
<p>
|
||||||
{% for action in page.header.actions %}
|
{% for action in page.header.actions %}
|
||||||
{% if action.url contains "://" %}
|
<a href="{{ action.url | relative_url }}" class="btn btn--light-outline btn--large">{{ action.label | default: site.data.ui-text[site.locale].more_label | default: "Learn More" }}</a>
|
||||||
{% assign url = action.url %}
|
|
||||||
{% else %}
|
|
||||||
{% assign url = action.url | relative_url %}
|
|
||||||
{% endif %}
|
|
||||||
<a href="{{ url }}" class="btn btn--light-outline btn--large">{{ action.label | default: site.data.ui-text[site.locale].more_label | default: "Learn More" }}</a>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<img src="{{ img_path }}" alt="{{ image_description }}" class="page__hero-image">
|
<img src="{{ pade.header.image | relative_url }}" alt="{{ image_description }}" class="page__hero-image">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if page.header.caption %}
|
{% if page.header.caption %}
|
||||||
<span class="page__hero-caption">{{ page.header.caption | markdownify | remove: "<p>" | remove: "</p>" }}</span>
|
<span class="page__hero-caption">{{ page.header.caption | markdownify | remove: "<p>" | remove: "</p>" }}</span>
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
{% if site.footer_scripts %}
|
{% if site.footer_scripts %}
|
||||||
{% for script in site.footer_scripts %}
|
{% for script in site.footer_scripts %}
|
||||||
{% if script contains "://" %}
|
<script src="{{ script | relative_url }}"></script>
|
||||||
{% capture script_path %}{{ script }}{% endcapture %}
|
|
||||||
{% else %}
|
|
||||||
{% capture script_path %}{{ script | relative_url }}{% endcapture %}
|
|
||||||
{% endif %}
|
|
||||||
<script src="{{ script_path }}"></script>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<script src="{{ '/assets/js/main.min.js' | relative_url }}"></script>
|
<script src="{{ '/assets/js/main.min.js' | relative_url }}"></script>
|
||||||
|
@ -29,11 +24,6 @@
|
||||||
|
|
||||||
{% if site.after_footer_scripts %}
|
{% if site.after_footer_scripts %}
|
||||||
{% for script in site.after_footer_scripts %}
|
{% for script in site.after_footer_scripts %}
|
||||||
{% if script contains "://" %}
|
<script src="{{ script | relative_url }}"></script>
|
||||||
{% capture script_path %}{{ script }}{% endcapture %}
|
|
||||||
{% else %}
|
|
||||||
{% capture script_path %}{{ script | relative_url }}{% endcapture %}
|
|
||||||
{% endif %}
|
|
||||||
<script src="{{ script_path }}"></script>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -32,22 +32,13 @@
|
||||||
{%- assign author_twitter = author.twitter | replace: "@", "" -%}
|
{%- assign author_twitter = author.twitter | replace: "@", "" -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
{%- assign page_large_image = page.header.og_image | default: page.header.overlay_image | default: page.header.image -%}
|
{%- assign page_large_image = page.header.og_image | default: page.header.overlay_image | default: page.header.image | absolute_url -%}
|
||||||
{%- unless page_large_image contains '://' -%}
|
|
||||||
{%- assign page_large_image = page_large_image | absolute_url -%}
|
|
||||||
{%- endunless -%}
|
|
||||||
{%- assign page_large_image = page_large_image | escape -%}
|
{%- assign page_large_image = page_large_image | escape -%}
|
||||||
|
|
||||||
{%- assign page_teaser_image = page.header.teaser | default: site.og_image -%}
|
{%- assign page_teaser_image = page.header.teaser | default: site.og_image | absolute_url -%}
|
||||||
{%- unless page_teaser_image contains '://' -%}
|
|
||||||
{%- assign page_teaser_image = page_teaser_image | absolute_url -%}
|
|
||||||
{%- endunless -%}
|
|
||||||
{%- assign page_teaser_image = page_teaser_image | escape -%}
|
{%- assign page_teaser_image = page_teaser_image | escape -%}
|
||||||
|
|
||||||
{%- assign site_og_image = site.og_image -%}
|
{%- assign site_og_image = site.og_image | absolute_url -%}
|
||||||
{%- unless site_og_image contains '://' -%}
|
|
||||||
{%- assign site_og_image = site_og_image | absolute_url -%}
|
|
||||||
{%- endunless -%}
|
|
||||||
{%- assign site_og_image = site_og_image | escape -%}
|
{%- assign site_og_image = site_og_image | escape -%}
|
||||||
|
|
||||||
{%- if page.date -%}
|
{%- if page.date -%}
|
||||||
|
|
|
@ -4,12 +4,7 @@
|
||||||
{% if page.sidebar %}
|
{% if page.sidebar %}
|
||||||
{% for s in page.sidebar %}
|
{% for s in page.sidebar %}
|
||||||
{% if s.image %}
|
{% if s.image %}
|
||||||
<img src=
|
<img src="{{ s.image | relative_url }}"
|
||||||
{% if s.image contains "://" %}
|
|
||||||
"{{ s.image }}"
|
|
||||||
{% else %}
|
|
||||||
"{{ s.image | relative_url }}"
|
|
||||||
{% endif %}
|
|
||||||
alt="{% if s.image_alt %}{{ s.image_alt }}{% endif %}">
|
alt="{% if s.image_alt %}{{ s.image_alt }}{% endif %}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if s.title %}<h3>{{ s.title }}</h3>{% endif %}
|
{% if s.title %}<h3>{{ s.title }}</h3>{% endif %}
|
||||||
|
|
7
assets/js/lunr/lunr-store.js
vendored
7
assets/js/lunr/lunr-store.js
vendored
|
@ -43,12 +43,7 @@ var store = [
|
||||||
"categories": {{ doc.categories | jsonify }},
|
"categories": {{ doc.categories | jsonify }},
|
||||||
"tags": {{ doc.tags | jsonify }},
|
"tags": {{ doc.tags | jsonify }},
|
||||||
"url": {{ doc.url | absolute_url | jsonify }},
|
"url": {{ doc.url | absolute_url | jsonify }},
|
||||||
"teaser":
|
"teaser": {{ teaser | absolute_url | jsonify }}
|
||||||
{%- if teaser contains "://" -%}
|
|
||||||
{{ teaser | jsonify }}
|
|
||||||
{%- else -%}
|
|
||||||
{{ teaser | absolute_url | jsonify }}
|
|
||||||
{%- endif -%}
|
|
||||||
}{%- unless forloop.last and l -%},{%- endunless -%}
|
}{%- unless forloop.last and l -%},{%- endunless -%}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
{%- endfor -%}]
|
{%- endfor -%}]
|
||||||
|
|
Loading…
Reference in a new issue