forked from deepStateMirrors/tabi
🐛 fix: support external URLs in menu (#481)
This commit is contained in:
parent
8fafc0f9c8
commit
5b5bdda456
4 changed files with 24 additions and 7 deletions
|
@ -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 },
|
||||
]
|
||||
```
|
||||
|
||||
|
|
|
@ -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 },
|
||||
]
|
||||
```
|
||||
|
||||
|
|
|
@ -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 },
|
||||
]
|
||||
```
|
||||
|
||||
|
|
|
@ -11,7 +11,15 @@
|
|||
{% for menu in config.extra.menu %}
|
||||
<li>
|
||||
{% set trailing_slash = menu.trailing_slash | default(value=true) %}
|
||||
{%- 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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue