Skip to content

Commit

Permalink
Fix: use relative links for menu items when possible (mmistakes#1783) (
Browse files Browse the repository at this point in the history
  • Loading branch information
olbat authored and mmistakes committed Aug 13, 2018
1 parent ca6612d commit 0a60ec7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions _includes/masthead.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -30,4 +30,4 @@
</nav>
</div>
</div>
</div>
</div>

0 comments on commit 0a60ec7

Please sign in to comment.