From 2c578bd15b95d3cbc208dd7233349086430c52c4 Mon Sep 17 00:00:00 2001 From: Henri Bourcereau Date: Sun, 23 Mar 2025 20:31:23 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(indieweb):=20add=20hidden=20h-?= =?UTF-8?q?card?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.toml | 18 +++++ content/blog/mastering-tabi-settings/index.md | 20 +++++- templates/partials/hcard.html | 70 +++++++++++++++++++ templates/section.html | 3 + theme.toml | 18 +++++ 5 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 templates/partials/hcard.html diff --git a/config.toml b/config.toml index 3fcbb9e..3604d7e 100644 --- a/config.toml +++ b/config.toml @@ -427,3 +427,21 @@ 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 = true # Enables the h-card on the home page +# with_mail = false # Add your email to the card if extra.email is set and not encoded +# with_social_links = true # Add your social links to the card +# homepage = "https://myhomepage.net" # Homepage url, default to the value of 'base_url' +# avatar = "img/profile.webp" +# full_name = "John Doe" # Display name, default to the value of 'author' +# biography = "Fond of the indieweb" # Small bio, as shown on social media profiles +# +# You can add any property from https://microformats.org/wiki/h-card#Properties +# Make sure to replace all '-' characters by '_' +# Below are some examples +# p_nickname = "nickname" +# p_locality = "Bordeaux" +# p_country_name = "France" diff --git a/content/blog/mastering-tabi-settings/index.md b/content/blog/mastering-tabi-settings/index.md index 4ab8238..93afe42 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-02 description = "Discover the many ways you can customise your tabi site." [taxonomies] @@ -1018,6 +1018,24 @@ See the [CSP documentation page](@/blog/security/index.md) for more information. --- +## Indieweb + +### Representative h-card + +| Page | Section | `config.toml` | Follows Hierarchy | Requires JavaScript | +| :--: | :-----: | :-----------: | :---------------: | :-----------------: | +| ❌ | ❌ | ✅ | ❌ | ❌ | + +Tabi adds a representative [h-card](https://microformats.org/wiki/h-card) to the homepage out of the box. It is hidden to the naked eye, but remains visible by microformat parsers. You can check the validity of the card with the [Indiewebify.me](https://indiewebify.me/validate-h-card/) tool. + +It is possible to disable the h-card by setting `enable = false` in the `[extra.hcard]` section of the config file. + +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..d5f652d --- /dev/null +++ b/templates/partials/hcard.html @@ -0,0 +1,70 @@ +{%- 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 %} + +{% endif %} diff --git a/templates/section.html b/templates/section.html index 77b6c73..3f2af39 100644 --- a/templates/section.html +++ b/templates/section.html @@ -24,6 +24,9 @@ {%- endif -%}
+{%- if config.extra.hcard %} + {%- include "partials/hcard.html" -%} +{% endif -%} {%- if section.extra.header %} {%- include "partials/home_banner.html" -%} {%- elif section.content -%} diff --git a/theme.toml b/theme.toml index db3384e..0260cbd 100644 --- a/theme.toml +++ b/theme.toml @@ -375,3 +375,21 @@ 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 = true # Enables the h-card on the home page +# with_mail = false # Add your email to the card if extra.email is set and not encoded +with_social_links = true # Add your social links to the card +# homepage = "https://myhomepage.net" # Homepage url, default to the value of 'base_url' +# avatar = "img/profile.webp" +# full_name = "John Doe" # Display name, default to the value of 'author' +# biography = "Fond of the indieweb" # Small bio, as shown on social media profiles +# +# You can add any property from https://microformats.org/wiki/h-card#Properties +# Make sure to replace all '-' characters by '_' +# Below are some examples +# p_nickname = "nickname" +# p_locality = "Bordeaux" +# p_country_name = "France"