forked from deepStateMirrors/tabi
✨ feat(indieweb): add hidden h-card (#506)
Co-authored-by: welpo <welpo@users.noreply.github.com>
This commit is contained in:
parent
a384ac80c8
commit
94af15b6e8
7 changed files with 188 additions and 4 deletions
24
config.toml
24
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"
|
||||
|
|
|
@ -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`
|
||||
|
|
|
@ -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`
|
||||
|
|
|
@ -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`.
|
||||
|
|
73
templates/partials/hcard.html
Normal file
73
templates/partials/hcard.html
Normal file
|
@ -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 %}
|
||||
<div class="h-card hidden">
|
||||
<div>
|
||||
{%- if hcard.avatar -%}
|
||||
<img
|
||||
class="u-photo"
|
||||
src="{{ get_url(path=hcard.avatar) }}"
|
||||
width="200"
|
||||
height="200"
|
||||
alt="{{ full_name }}"
|
||||
/>
|
||||
{%- endif -%}
|
||||
|
||||
<span class="p-name" rel="me">{{ full_name }}</span>
|
||||
|
||||
{% if hcard.p_nickname %}
|
||||
( <span class="p-nickname">{{ hcard.p_nickname }}</span> )
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if hcard.biography %}
|
||||
<p class="p-note">{{ hcard.biography }}</p>
|
||||
{% endif %}
|
||||
|
||||
{# links #}
|
||||
<div>
|
||||
{%- if hcard.with_mail and config.extra.email and not config.extra.encode_plaintext_email -%}
|
||||
<span>
|
||||
<a class="u-email" href="mailto:{{ config.extra.email | safe }}">email</a>
|
||||
</span> -
|
||||
{%- endif -%}
|
||||
|
||||
<span>
|
||||
<a class="u-url u-id" href="{{ homepage }}">homepage</a>
|
||||
</span> -
|
||||
|
||||
{%- if hcard.with_social_links and config.extra.socials %}
|
||||
{% for social in config.extra.socials %}
|
||||
<span>
|
||||
<a class="p-url" rel="me" href="{{ social.url | safe }}">{{ social.name }}</a>
|
||||
</span> -
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{# additional properties #}
|
||||
{% set dl_started = false %}
|
||||
{% for key, value in hcard %}
|
||||
{% if key not in ['enable', 'with_mail', 'with_social_links', 'homepage', 'full_name', 'avatar', 'biography', 'p_nickname'] %}
|
||||
{% if not dl_started %}
|
||||
<dl>
|
||||
{% set dl_started = true %}
|
||||
{% endif %}
|
||||
<dt>{{ key | replace(from="p_", to="") | replace(from="u_", to="") | replace(from="dt_", to="") | replace(from="_", to=" ") | capitalize }}</dt>
|
||||
<dd class="{{ key | replace(from="_", to="-") }}">{{ value }}</dd>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if dl_started %}
|
||||
</dl>
|
||||
{% endif %}
|
||||
{% endif %}
|
|
@ -24,6 +24,9 @@
|
|||
{%- endif -%}
|
||||
|
||||
<main {% if more_than_one_section_shown %}class="{{ first_section }}-first"{% endif %}>
|
||||
{%- if config.extra.hcard %}
|
||||
{%- include "partials/hcard.html" -%}
|
||||
{% endif -%}
|
||||
{%- if section.extra.header %}
|
||||
{%- include "partials/home_banner.html" -%}
|
||||
{%- elif section.content -%}
|
||||
|
|
24
theme.toml
24
theme.toml
|
@ -375,3 +375,27 @@ custom_subset = 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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue