From 94af15b6e8068182e6c095eaf5059d26711c7919 Mon Sep 17 00:00:00 2001 From: Henri Bourcereau Date: Sat, 5 Apr 2025 14:10:16 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(indieweb):=20add=20hidden=20h-?= =?UTF-8?q?card=20(#506)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: welpo --- config.toml | 24 ++++++ .../blog/mastering-tabi-settings/index.ca.md | 22 +++++- .../blog/mastering-tabi-settings/index.es.md | 22 +++++- content/blog/mastering-tabi-settings/index.md | 24 +++++- templates/partials/hcard.html | 73 +++++++++++++++++++ templates/section.html | 3 + theme.toml | 24 ++++++ 7 files changed, 188 insertions(+), 4 deletions(-) create mode 100644 templates/partials/hcard.html diff --git a/config.toml b/config.toml index 3fcbb9e..cedb2f1 100644 --- a/config.toml +++ b/config.toml @@ -427,3 +427,27 @@ avatar = true voting = true page_author_hashes = "" # hash (or list of hashes) of the author. lazy_loading = true # Loads when the comments are in the viewport (using the Intersection Observer API). + +# h-card configuration +# Will identify you on the indieweb (see https://microformats.org/wiki/h-card) +[extra.hcard] +# Enable home page h-card. +# enable = true +# Add your email to the card if extra.email is set and not encoded. +# with_mail = true +# Add your social links ('socials' config) to the card. +# with_social_links = true +# Homepage url. Defaults to the value of 'base_url'. +# homepage = "https://myhomepage.net" +# avatar = "img/profile.webp" +# Display name, default to the value of 'author'. +# full_name = "John Doe" +# Small bio, as shown on social media profiles. +# biography = "Fond of the indieweb" +# +# You can add any property from https://microformats.org/wiki/h-card#Properties +# Make sure to replace all '-' characters by '_' +# Examples: +# p_nickname = "nickname" +# p_locality = "Bordeaux" +# p_country_name = "France" diff --git a/content/blog/mastering-tabi-settings/index.ca.md b/content/blog/mastering-tabi-settings/index.ca.md index 74f62f4..4ce5225 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-02-16 +updated = 2025-04-05 description = "Descobreix les múltiples maneres en què pots personalitzar tabi." [taxonomies] @@ -1007,6 +1007,26 @@ Per a més informació, consulta la [pàgina de documentació de CSP](@/blog/sec --- +## Indieweb + +### h-card representativa + +| Pàgina | Secció | `config.toml` | Segueix la jerarquia | Requereix JavaScript | +| :--: | :-----: | :-----------: | :---------------: | :-----------------: | +| ❌ | ❌ | ✅ | ❌ | ❌ | + +Per defecte, tabi afegeix una h-card representativa [h-card](https://microformats.org/wiki/h-card) **oculta** a la pàgina d'inici. Tot i que és invisible per als visitants, està disponible per als analitzadors de microformats. Pots comprovar la validesa de la targeta amb l'eina [Indiewebify.me](https://indiewebify.me/validate-h-card/). + +Per desactivar l'h-card, estableix `enable = false` a la secció `[extra.hcard]` de `config.toml`. + +L'h-card predeterminada inclou el teu nom, l'URL del lloc web i els enllaços a les xarxes socials. + +Pots establir una imatge de perfil i una petita biografia amb els paràmetres `avatar` i `biography`. + +Totes les altres [propietats h-card](https://microformats.org/wiki/h-card#Properties) es poden afegir llistant-les a la secció `[extra.hcard]` del fitxer de configuració. Simplement substitueix tots els caràcters `-` per `_`. + +--- + [^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` diff --git a/content/blog/mastering-tabi-settings/index.es.md b/content/blog/mastering-tabi-settings/index.es.md index e999216..5fcefd4 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-02-16 +updated = 2025-04-05 description = "Descubre las múltiples maneras en que puedes personalizar tabi." [taxonomies] @@ -1008,6 +1008,26 @@ Para obtener más información, consulta la [página de documentación de CSP](@ --- +## Indieweb + +### h-card representativa + +| Página | Sección | `config.toml` | Sigue Jerarquía | Requiere JavaScript | +| :--: | :-----: | :-----------: | :---------------: | :-----------------: | +| ❌ | ❌ | ✅ | ❌ | ❌ | + +Por defecto, tabi añade una [h-card](https://microformats.org/wiki/h-card) representativa **oculta** a la página de inicio. Aunque es invisible para los visitantes, está disponible para los analizadores de microformatos. Puedes comprobar la validez de la tarjeta con la herramienta [Indiewebify.me](https://indiewebify.me/validate-h-card/). + +Para desactivar la h-card, establece `enable = false` en la sección `[extra.hcard]` de `config.toml`. + +La h-card predeterminada incluye tu nombre, la URL del sitio web y los enlaces a redes sociales. + +Puedes establecer una imagen de perfil y una pequeña biografía con los ajustes `avatar` y `biography`. + +Todas las demás [propiedades de h-card](https://microformats.org/wiki/h-card#Properties) se pueden añadir listándolas en la sección `[extra.hcard]` del archivo de configuración. Simplemente reemplaza todos los caracteres `-` por `_`. + +--- + [^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` diff --git a/content/blog/mastering-tabi-settings/index.md b/content/blog/mastering-tabi-settings/index.md index 4ab8238..c212e5e 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-02-16 +updated = 2025-04-04 description = "Discover the many ways you can customise your tabi site." [taxonomies] @@ -113,7 +113,7 @@ The description is regular Markdown content, set outside the front matter. #### Listing Recent Posts -To show posts on your main page, you first need to decide where these posts will be served from: the root path (`/`) or a subdirectory (e.g., `/blog`). +To show posts on your main page, you first need to decide where these posts will be served from: the root path (`/`) or a subdirectory (e.g., `/blog`). **Option A: Serve posts from the root path (`/`)** @@ -1018,6 +1018,26 @@ See the [CSP documentation page](@/blog/security/index.md) for more information. --- +## Indieweb + +### Representative h-card + +| Page | Section | `config.toml` | Follows Hierarchy | Requires JavaScript | +| :--: | :-----: | :-----------: | :---------------: | :-----------------: | +| ❌ | ❌ | ✅ | ❌ | ❌ | + +By default, tabi adds a **hidden** representative [h-card](https://microformats.org/wiki/h-card) to the homepage. While invisible to visitors, it's available to microformat parsers. You can check the validity of the card with the [Indiewebify.me](https://indiewebify.me/validate-h-card/) tool. + +To disable the h-card, set `enable = false` in the `[extra.hcard]` section of `config.toml`. + +The default h-card includes your name, website url and social media links. + +You can set a profile picture and a small bio with the `avatar` and `biography` settings. + +All other [h-card properties](https://microformats.org/wiki/h-card#Properties) can be added by listing them under the `[extra.hcard]`section of the config file. Simply replace all `-` characters by `_`. + +--- + [^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`. diff --git a/templates/partials/hcard.html b/templates/partials/hcard.html new file mode 100644 index 0000000..1b191bd --- /dev/null +++ b/templates/partials/hcard.html @@ -0,0 +1,73 @@ +{%- set hcard = config.extra.hcard -%} + +{% set full_name = config.author %} +{% if hcard.full_name %} + {% set full_name = hcard.full_name %} +{% endif %} + +{%- set homepage = config.base_url -%} +{% if hcard.homepage %} + {%- set homepage = hcard.homepage -%} +{% endif %} + +{% if hcard.enable %} +