Fix: use relative links for menu items when possible (#1783) (#1784)

This commit is contained in:
Luc Sarzyniec 2018-08-13 14:00:39 +02:00 committed by Michael Rose
parent 67f94f0588
commit f5c33989c8

View file

@ -4,16 +4,16 @@
<nav id="site-nav" class="greedy-nav">
<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' %}
{% assign domain = '' %}
{% else %}
{% assign domain = site.url | append: site.baseurl %}
{% endif %}
{%- 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">
<a href="{{ domain }}{{ link.url }}" {% if link.description %}title="{{ link.description }}"{% endif %}>{{ link.title }}</a>
<a href="{{ url }}" {% if link.description %}title="{{ link.description }}"{% endif %}>{{ link.title }}</a>
</li>
{% endfor %}
{%- endfor -%}
</ul>
{% if site.search == true %}
<button class="search__toggle" type="button">