feat: extend tabi <head> and <body> elements (#528)

Co-authored-by: welpo <welpo@users.noreply.github.com>
This commit is contained in:
Cameron Taylor 2025-06-01 08:12:41 -07:00 committed by GitHub
parent 5c1e4acbb1
commit 979f347fb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 53 additions and 3 deletions

View file

@ -1,7 +1,7 @@
+++
title = "Domina la configuració de tabi: guia completa"
date = 2023-09-18
updated = 2025-04-05
updated = 2025-06-01
description = "Descobreix les múltiples maneres en què pots personalitzar tabi."
[taxonomies]
@ -1027,6 +1027,21 @@ Totes les altres [propietats h-card](https://microformats.org/wiki/h-card#Proper
---
## Estenent elements HTML a tabi
Alguns elements HTML a tabi es poden estendre per admetre casos d'ús addicionals, com ara afegir JavaScript personalitzat per a comportaments a tot el lloc al final de l'etiqueta `<body>` o incloure contingut addicional al final de l'element `<head>` que no estigui suportat per altres configuracions de tabi.
Consulta la taula a continuació per veure els elements que es poden estendre:
| Element | Plantilla |
| :------: | :-------------------------------: |
| `<head>` | `templates/tabi/extend_head.html` |
| `<body>` | `templates/tabi/extend_body.html` |
No hi ha configuracions explícites que hagis d'establir per al teu lloc o pàgines. Simplement crea el fitxer de plantilla corresponent per al teu lloc, i tabi l'inclourà automàticament.
---
[^1]: Si estàs utilitzant un repositori Git remot, potser voldràs automatitzar el procés d'actualització del camp `updated`. Aquí tens una guia per a això: [Zola Git Hook: actualitzant les dates de les publicacions](https://osc.garden/ca/blog/zola-date-git-hook/).
[^2]: Per a codificar el teu correu electrònic en base64 pots utilitzar [eines en línia](https://www.base64encode.org/) o, al teu terminal, executar: `printf 'mail@example.com' | base64`

View file

@ -1,7 +1,7 @@
+++
title = "Domina la configuración de tabi: guía completa"
date = 2023-09-18
updated = 2025-04-05
updated = 2025-06-01
description = "Descubre las múltiples maneras en que puedes personalizar tabi."
[taxonomies]
@ -1028,6 +1028,21 @@ Todas las demás [propiedades de h-card](https://microformats.org/wiki/h-card#Pr
---
## Extendiendo elementos HTML en tabi
Algunos elementos HTML en tabi pueden extenderse para admitir casos de uso adicionales, como agregar JavaScript personalizado para comportamientos en todo el sitio al final de la etiqueta `<body>` o incluir contenido adicional al final del elemento `<head>` que no esté soportado por otras configuraciones de tabi.
Consulta la tabla a continuación para ver los elementos que pueden extenderse:
| Elemento | Plantilla |
| :------: | :-------------------------------: |
| `<head>` | `templates/tabi/extend_head.html` |
| `<body>` | `templates/tabi/extend_body.html` |
No hay configuraciones explícitas que debas establecer para tu sitio o páginas. Simplemente crea el archivo de plantilla correspondiente para tu sitio, y tabi lo incluirá automáticamente.
---
[^1]: Si estás utilizando un repositorio Git remoto, es posible que quieras automatizar el proceso de actualización del campo `updated`. Aquí tienes una guía para eso: [Zola Git Hook: actualizando las fechas de las publicaciones](https://osc.garden/es/blog/zola-date-git-hook/).
[^2]: Para codificar tu correo electrónico en base64 puedes utilizar [herramientas en línea](https://www.base64encode.org/) o, en tu terminal, ejecutar: `printf 'mail@example.com' | base64`

View file

@ -1,7 +1,7 @@
+++
title = "Mastering tabi Settings: A Comprehensive Guide"
date = 2023-09-18
updated = 2025-04-04
updated = 2025-06-01
description = "Discover the many ways you can customise your tabi site."
[taxonomies]
@ -1038,6 +1038,21 @@ All other [h-card properties](https://microformats.org/wiki/h-card#Properties) c
---
## Extending HTML Elements in tabi
Some HTML elements in tabi can be extended to support additional use cases such as adding custom JavaScript for site-wide behavior at the end of the `<body>` tag or including additional content at the end of the `<head>` element that is not otherwise supported by other tabi settings.
See the table below for elements that can be extended:
| Element | Template |
| :------: | :-------------------------------: |
| `<head>` | `templates/tabi/extend_head.html` |
| `<body>` | `templates/tabi/extend_body.html` |
There are no explicit settings to configure for your site or pages. Simply create the relevant template file for your site, and tabi will automatically include it.
---
[^1]: If you're using a remote Git repository, you might want to automate the process of updating the `updated` field. Here's a guide for that: [Zola Git Pre-Commit Hook: Updating Post Dates](https://osc.garden/blog/zola-date-git-hook/).
[^2]: To encode your email in base64 you can use [online tools](https://www.base64encode.org/) or, on your terminal, run: `printf 'mail@example.com' | base64`.

View file

@ -43,6 +43,9 @@ This variable will hold all the text strings for the language #}
{% endblock main_content %}
</div>
{% include "partials/footer.html" %}
{# Users can optionally provide this template to add content to the body element. #}
{% include "tabi/extend_body.html" ignore missing %}
</body>
</html>

View file

@ -177,4 +177,6 @@
{%- endif -%}
{%- endif -%}
{# Users can optionally provide this template to add content to the head element. #}
{% include "tabi/extend_head.html" ignore missing %}
</head>