From 5b5bdda456b45b9a71c1c3f215aade5aa18df481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar?= Date: Sun, 2 Feb 2025 14:25:52 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20support=20external=20URLs?= =?UTF-8?q?=20in=20menu=20(#481)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/blog/mastering-tabi-settings/index.ca.md | 7 +++++-- content/blog/mastering-tabi-settings/index.es.md | 7 +++++-- content/blog/mastering-tabi-settings/index.md | 7 +++++-- templates/partials/nav.html | 10 +++++++++- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/content/blog/mastering-tabi-settings/index.ca.md b/content/blog/mastering-tabi-settings/index.ca.md index 43fec2d..8f5c57a 100644 --- a/content/blog/mastering-tabi-settings/index.ca.md +++ b/content/blog/mastering-tabi-settings/index.ca.md @@ -1,7 +1,7 @@ +++ title = "Domina la configuració de tabi: guia completa" date = 2023-09-18 -updated = 2025-01-12 +updated = 2025-02-02 description = "Descobreix les múltiples maneres en què pots personalitzar tabi." [taxonomies] @@ -587,7 +587,9 @@ fediverse_creator = { handle = "username", domain = "example.com" } |:------:|:------:|:-------------:|:---------------:|:-------------------:| | ❌ | ❌ | ✅ | ❌ | ❌ | -La barra de navegació és la franja a la part superior de la pàgina que conté el títol del lloc i el menú de navegació. Pots personalitzar els elements que apareixen configurant `menu` en `config.toml`. Per exemple: +La barra de navegació és la franja a la part superior de la pàgina que conté el títol del lloc i el menú de navegació. Pots personalitzar els elements que apareixen configurant `menu` en `config.toml`. + +Soporta links relatius per a pàgines internes i links absoluts per a enllaços externs. Per exemple: ```toml menu = [ @@ -596,6 +598,7 @@ menu = [ { name = "etiquetes", url = "tags", trailing_slash = true }, { name = "projectes", url = "projects", trailing_slash = true }, { name = "sobre nosaltres", url = "about", trailing_slash = true }, + { name = "github", url = "https://github.com/welpo/tabi", trailing_slash = false }, ] ``` diff --git a/content/blog/mastering-tabi-settings/index.es.md b/content/blog/mastering-tabi-settings/index.es.md index a7c4a42..ff11f0e 100644 --- a/content/blog/mastering-tabi-settings/index.es.md +++ b/content/blog/mastering-tabi-settings/index.es.md @@ -1,7 +1,7 @@ +++ title = "Domina la configuración de tabi: guía completa" date = 2023-09-18 -updated = 2025-01-12 +updated = 2025-02-02 description = "Descubre las múltiples maneras en que puedes personalizar tabi." [taxonomies] @@ -587,7 +587,9 @@ fediverse_creator = { handle = "username", domain = "example.com" } |:------:|:-------:|:-------------:|:---------------:|:-------------------:| | ❌ | ❌ | ✅ | ❌ | ❌ | -La barra de navegación es la barra en la parte superior de la página que contiene el título del sitio y el menú de navegación. Puedes personalizar los elementos que aparecen configurando `menu` en `config.toml`. Por ejemplo: +La barra de navegación es la barra en la parte superior de la página que contiene el título del sitio y el menú de navegación. Puedes personalizar los elementos que aparecen configurando `menu` en `config.toml`. + +Soporta links relativos para páginas internas y links absolutos para enlaces externos. Por ejemplo: ```toml menu = [ @@ -596,6 +598,7 @@ menu = [ { name = "etiquetas", url = "tags", trailing_slash = true }, { name = "proyectos", url = "projects", trailing_slash = true }, { name = "acerca de", url = "about", trailing_slash = true }, + { name = "github", url = "https://github.com/welpo/tabi", trailing_slash = false }, ] ``` diff --git a/content/blog/mastering-tabi-settings/index.md b/content/blog/mastering-tabi-settings/index.md index a41d793..ab8814b 100644 --- a/content/blog/mastering-tabi-settings/index.md +++ b/content/blog/mastering-tabi-settings/index.md @@ -1,7 +1,7 @@ +++ title = "Mastering tabi Settings: A Comprehensive Guide" date = 2023-09-18 -updated = 2025-01-12 +updated = 2025-02-02 description = "Discover the many ways you can customise your tabi site." [taxonomies] @@ -594,7 +594,9 @@ This adds metadata to your HTML, allowing Mastodon to display the author's fediv |:----:|:-------:|:-------------:|:-----------------:|:-------------------:| | ❌ | ❌ | ✅ | ❌ | ❌ | -The navigation bar is the bar at the top of the page that contains the site title and the navigation menu. You can customise which items appear by setting `menu` in `config.toml`. For example: +The navigation bar is the bar at the top of the page that contains the site title and the navigation menu. You can customise which items appear by setting `menu` in `config.toml`. + +The menu supports both relative URLs for internal pages and absolute URLs for external links. For example: ```toml menu = [ @@ -603,6 +605,7 @@ menu = [ { name = "tags", url = "tags", trailing_slash = true }, { name = "projects", url = "projects", trailing_slash = true }, { name = "about", url = "about", trailing_slash = true }, + { name = "github", url = "https://github.com/welpo/tabi", trailing_slash = false }, ] ``` diff --git a/templates/partials/nav.html b/templates/partials/nav.html index ba61dc8..f4b0948 100644 --- a/templates/partials/nav.html +++ b/templates/partials/nav.html @@ -11,7 +11,15 @@ {% for menu in config.extra.menu %}
  • {% set trailing_slash = menu.trailing_slash | default(value=true) %} - + {%- if menu.url is starting_with("http") -%} + {%- if trailing_slash -%} + + {%- else -%} + + {%- endif -%} + {%- else -%} + + {%- endif -%} {{ macros_translate::translate(key=menu.name, default=menu.name, language_strings=language_strings) }}