templates/base: support opening nav items in new tab

This commit is contained in:
Clayton Craft 2023-02-10 10:23:08 -08:00
parent 7daa254c0b
commit baaaf164c1
No known key found for this signature in database
GPG key ID: 4A4CED6D7EDF950A
2 changed files with 3 additions and 2 deletions

View file

@ -56,6 +56,7 @@ header_nav = [
{ name = "#tags", url = "/tags" },
{ name = "+categories", url = "/categories" },
{ name = "@contexts", url = "/contexts" },
{ name = "example", url = "http://example.com", new_tab=true },
]
footer_nav = [
{ name = "< previous", url = "#" },

View file

@ -98,7 +98,7 @@
{% if config.extra.header_nav %}
<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 %}
</nav>
{% endif %}
@ -120,4 +120,4 @@
</div>
</body>
</html>