🐛 fix: support external URLs in menu (#481)

This commit is contained in:
Óscar 2025-02-02 14:25:52 +01:00 committed by GitHub
parent 8fafc0f9c8
commit 5b5bdda456
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 7 deletions

View file

@ -11,7 +11,15 @@
{% for menu in config.extra.menu %}
<li>
{% set trailing_slash = menu.trailing_slash | default(value=true) %}
<a class="nav-links no-hover-padding" href="{{ get_url(path=menu.url, lang=lang, trailing_slash=trailing_slash) }}">
{%- if menu.url is starting_with("http") -%}
{%- if trailing_slash -%}
<a class="nav-links no-hover-padding" href="{{ menu.url }}/">
{%- else -%}
<a class="nav-links no-hover-padding" href="{{ menu.url }}">
{%- endif -%}
{%- else -%}
<a class="nav-links no-hover-padding" href="{{ get_url(path=menu.url, lang=lang, trailing_slash=trailing_slash) }}">
{%- endif -%}
{{ macros_translate::translate(key=menu.name, default=menu.name, language_strings=language_strings) }}
</a>
</li>