refactor navbar menus code
This commit is contained in:
parent
45d36f06d8
commit
da5e93841b
@ -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 %}
|
||||
|
Loading…
Reference in New Issue
Block a user