support external links in navbar; fixes #3
This commit is contained in:
parent
337a89ff53
commit
84fbbe8a83
@ -13,8 +13,23 @@
|
|||||||
<div class="collapse navbar-collapse" id="main-navbar">
|
<div class="collapse navbar-collapse" id="main-navbar">
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
{% for link in site.navbar-links %}
|
{% for link in site.navbar-links %}
|
||||||
|
{% capture before %}{{ link[1] | split: "://" | first }}{% endcapture %}
|
||||||
|
{% capture after %}{{ link[1] | split: "://" | last }}{% endcapture %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ site.baseurl }}/{{ link[1] }}">{{ link[0] }}</a>
|
{% 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>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user