feat: optional trailing slash in menu links

Enabled by default.

Drops the `$BASE_URL` transformation to avoid confusion (#99).
main
welpo 2 years ago
parent ae47f79d9d
commit f9c18b0398
No known key found for this signature in database
GPG Key ID: A2F978CF4EC1F5A6

@ -162,10 +162,10 @@ favicon_emoji = "🌱"
headerImage = ""
menu = [
{ name = "blog", url = "blog/" },
{ name = "archive", url = "archive/" },
{ name = "tags", url = "tags/" },
{ name = "projects", url = "projects/" },
{ name = "blog", url = "blog", trailing_slash = true },
{ name = "archive", url = "archive", trailing_slash = true },
{ name = "tags", url = "tags", trailing_slash = true },
{ name = "projects", url = "projects", trailing_slash = true },
]
# The RSS icon will be shown if (1) it's enabled and (2) the following variable is set to true.

@ -12,7 +12,7 @@
{%- endif -%}
{% for social in config.extra.socials %}
<li>
<a rel="noopener noreferrer" target="_blank" class="nav-links no-hover-padding social" href={{ social.url | safe | replace(from="$BASE_URL", to=config.base_url) }}>
<a rel="noopener noreferrer" target="_blank" class="nav-links no-hover-padding social" href={{ social.url | safe }}>
<img alt={{ social.name }} title={{ social.name }} src="{{config.base_url}}/social_icons/{{ social.icon }}.svg">
</a>
</li>

@ -10,7 +10,8 @@
{%- if config.extra.menu %}
{% for menu in config.extra.menu %}
<li>
<a class="nav-links no-hover-padding" href={{ get_url(path=menu.url, lang=lang) | safe | replace(from="$BASE_URL", to=config.base_url) }}/>
{% 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 lang != config.default_language -%}
{{ trans(key=menu.name | safe, lang=lang) }}
{%- else -%}

Loading…
Cancel
Save