templates/base: support opening nav items in new tab
This commit is contained in:
parent
7daa254c0b
commit
baaaf164c1
2 changed files with 3 additions and 2 deletions
|
@ -56,6 +56,7 @@ header_nav = [
|
||||||
{ name = "#tags", url = "/tags" },
|
{ name = "#tags", url = "/tags" },
|
||||||
{ name = "+categories", url = "/categories" },
|
{ name = "+categories", url = "/categories" },
|
||||||
{ name = "@contexts", url = "/contexts" },
|
{ name = "@contexts", url = "/contexts" },
|
||||||
|
{ name = "example", url = "http://example.com", new_tab=true },
|
||||||
]
|
]
|
||||||
footer_nav = [
|
footer_nav = [
|
||||||
{ name = "< previous", url = "#" },
|
{ name = "< previous", url = "#" },
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
{% if config.extra.header_nav %}
|
{% if config.extra.header_nav %}
|
||||||
<nav>
|
<nav>
|
||||||
{% for nav_item in config.extra.header_nav %}
|
{% for nav_item in config.extra.header_nav %}
|
||||||
<a href="{{ nav_item.url | safe }}">{{ nav_item.name }}</a>
|
<a href="{{ nav_item.url | safe }}" {% if nav_item.new_tab %}target="_blank" rel="noreferrer noopener"{% endif %}>{{ nav_item.name }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</nav>
|
</nav>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in a new issue