Create navbarlink.html

This commit is contained in:
Dean Attali 2016-03-18 03:04:22 -07:00
parent 18741145c0
commit 45d36f06d8
1 changed files with 16 additions and 0 deletions

16
_includes/navbarlink.html Normal file
View File

@ -0,0 +1,16 @@
{% capture before %}{{ include.link[1] | split: "://" | first }}{% endcapture %}
{% capture after %}{{ include.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 }}/{{ include.link[1] }}{% endcapture %}
{% else %}
{% capture linkurl %}{{ include.link[1] }}{% endcapture %}
{% endif %}
<a href="{{ linkurl }}">{{ include.link[0] }}</a>