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"> <nav id="site-nav" class="greedy-nav">
<a class="site-title" href="{{ '/' | relative_url }}">{{ site.title }}</a> <a class="site-title" href="{{ '/' | relative_url }}">{{ site.title }}</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 'http' %} {%- if link.url contains '://' -%}
{% assign domain = '' %} {%- assign url = link.url -%}
{% else %} {%- else -%}
{% assign domain = site.url | append: site.baseurl %} {%- assign url = link.url | relative_url -%}
{% endif %} {%- endif -%}
<li class="masthead__menu-item"> <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> </li>
{% endfor %} {%- endfor -%}
</ul> </ul>
{% if site.search == true %} {% if site.search == true %}
<button class="search__toggle" type="button"> <button class="search__toggle" type="button">