Browse Source

refactor navbar menus code

master
Dean Attali 9 years ago
parent
commit
da5e93841b
1 changed files with 2 additions and 32 deletions
  1. +2
    -32
      _includes/nav.html

+ 2
- 32
_includes/nav.html View File

@ -19,44 +19,14 @@
<div class="navlinks-children">
{% for childlink in link[1] %}
{% for linkparts in childlink %}
{% capture before %}{{ linkparts[1] | split: "://" | first }}{% endcapture %}
{% capture after %}{{ linkparts[1] | split: "://" | last }}{% endcapture %}
{% assign internal = true %}
{% if before != after %}
{% if before == "http" or before == "https" %}
{% assign internal = false %}
{% endif %}
{% endif %}
{% if internal %}
{% capture linkurl %}{{ site.baseurl }}/{{ linkparts[1] }}{% endcapture %}
{% else %}
{% capture linkurl %}{{ linkparts[1] }}{% endcapture %}
{% endif %}
<a href="{{ linkurl }}">{{ linkparts[0] }}</a>
{% include navbarlink.html link=linkparts %}
{% endfor %}
{% endfor %}
</div>
</li>
{% else %}
<li>
{% capture before %}{{ link[1] | split: "://" | first }}{% endcapture %}
{% capture after %}{{ link[1] | split: "://" | last }}{% endcapture %}
{% assign internal = true %}
{% if before != after %}
{% if before == "http" or before == "https" %}
{% assign internal = false %}
{% endif %}
{% endif %}
{% if internal %}
{% capture linkurl %}{{ site.baseurl }}/{{ link[1] }}{% endcapture %}
{% else %}
{% capture linkurl %}{{ link[1] }}{% endcapture %}
{% endif %}
<a href="{{ linkurl }}">{{ link[0] }}</a>
{% include navbarlink.html link=link %}
</li>
{% endif %}
{% endfor %}


|||||||
x
 
000:0
Loading…
Cancel
Save