Merge branch 'new-tab' into 'main'

templates/base: support opening nav items in new tab

See merge request 4bcx/no-style-please!4
This commit is contained in:
Ahmed Alaa 2023-04-05 18:46:07 +00:00
commit e094ecaf35
2 changed files with 3 additions and 2 deletions

View file

@ -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 = "#" },

View file

@ -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 %}
@ -120,4 +120,4 @@
</div> </div>
</body> </body>
</html> </html>