From 886aa59545a400180470ddc137000d0f223c582f Mon Sep 17 00:00:00 2001 From: Ariel Richtman <10679234+arichtman@users.noreply.github.com> Date: Thu, 10 Oct 2024 19:53:39 +0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20fediverse=20creator?= =?UTF-8?q?=20metadata=20support=20(#409)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add `fediverse_creator` variable to highlight author's fediverse profile in Mastodon link previews. Co-authored-by: Ariel Richtman Co-authored-by: welpo --- config.toml | 5 +++++ content/blog/mastering-tabi-settings/index.ca.md | 12 ++++++++++++ content/blog/mastering-tabi-settings/index.es.md | 12 ++++++++++++ content/blog/mastering-tabi-settings/index.md | 14 ++++++++++++++ templates/partials/header.html | 5 +++++ theme.toml | 5 +++++ 6 files changed, 53 insertions(+) diff --git a/config.toml b/config.toml index d255a90ef..078dba9ed 100644 --- a/config.toml +++ b/config.toml @@ -267,6 +267,11 @@ socials = [ { name = "spotify", url = "https://open.spotify.com/artist/5Hv2bYBhMp1lUHFri06xkE", icon = "spotify" }, ] +# Fediverse profile. +# Adds metadata to feature the author's profile in Mastodon link previews. +# Example: for @username@example.com, use: +# fediverse_creator = { handle = "username", domain = "example.com" } + # Extra menu to show on the footer, below socials section. footer_menu = [ {url = "about", name = "about", trailing_slash = true}, diff --git a/content/blog/mastering-tabi-settings/index.ca.md b/content/blog/mastering-tabi-settings/index.ca.md index 42ff05343..a0f3552a5 100644 --- a/content/blog/mastering-tabi-settings/index.ca.md +++ b/content/blog/mastering-tabi-settings/index.ca.md @@ -470,6 +470,18 @@ Ja que segueix la [jerarquia](#jerarquia-de-configuracio), si no està configura **Consell**: automatitza la seva creació amb un [script](https://github.com/welpo/osc.garden/blob/main/static/code/social-cards-zola): [De reservat a rei de les xarxes: automatitzant les vistes prèvies dels enllaços amb Zola](https://osc.garden/ca/blog/automating-social-media-cards-zola/). +### Creador del fedivers + +| Pàgina | Secció | `config.toml` | Segueix jerarquia | Requereix JavaScript | +|:------:|:------:|:-------------:|:-----------------:|:--------------------:| +| ❌ | ❌ | ✅ | ❌ | ❌ | + +Pots mostrar el perfil del fedivers de l'autor en les previsualitzacions d'enllaços de Mastodon configurant la variable `fediverse_creator` al teu `config.toml`. Per exemple, per a @username@example.com, fes servir: + +```toml +fediverse_creator = { handle = "username", domain = "example.com" } +``` + --- ## Navegació diff --git a/content/blog/mastering-tabi-settings/index.es.md b/content/blog/mastering-tabi-settings/index.es.md index 217eb73a1..1996c4a5b 100644 --- a/content/blog/mastering-tabi-settings/index.es.md +++ b/content/blog/mastering-tabi-settings/index.es.md @@ -470,6 +470,18 @@ Dado que sigue la [jerarquía](#jerarquia-de-configuracion), si no está configu **Consejo**: automatiza su creación con un [script](https://github.com/welpo/osc.garden/blob/main/static/code/social-cards-zola): [De reservado a rey de las redes: automatizando las vistas previas de los enlaces con Zola](https://osc.garden/es/blog/automating-social-media-cards-zola/). +### Creador del fediverso + +| Página | Sección | `config.toml` | Sigue jerarquía | Requiere JavaScript | +|:------:|:-------:|:-------------:|:----------------:|:-------------------:| +| ❌ | ❌ | ✅ | ❌ | ❌ | + +Puedes mostrar tu perfil del fediverso en las vistas previas de enlaces de Mastodon configurando la variable `fediverse_creator` en tu `config.toml`. Por ejemplo, para @username@example.com, usa: + +```toml +fediverse_creator = { handle = "username", domain = "example.com" } +``` + --- ## Navegación diff --git a/content/blog/mastering-tabi-settings/index.md b/content/blog/mastering-tabi-settings/index.md index 5f1763fb4..8a7023e71 100644 --- a/content/blog/mastering-tabi-settings/index.md +++ b/content/blog/mastering-tabi-settings/index.md @@ -475,6 +475,20 @@ Since it follows the [hierarchy](#settings-hierarchy), if it's not set on a page **Protip**: automate their creation with a [script](https://github.com/welpo/osc.garden/blob/main/static/code/social-cards-zola): [From Bashful to Social Butterfly: Automating Link Previews for Zola Sites](https://osc.garden/blog/automating-social-media-cards-zola/). +### Fediverse Creator + +| Page | Section | `config.toml` | Follows Hierarchy | Requires JavaScript | +|:----:|:-------:|:-------------:|:-----------------:|:-------------------:| +| ❌ | ❌ | ✅ | ❌ | ❌ | + +You can highlight your fediverse profile in Mastodon link previews by setting the `fediverse_creator` variable in your `config.toml`. For example, for @username@example.com, use: + +```toml +fediverse_creator = { handle = "username", domain = "example.com" } +``` + +This adds metadata to your HTML, allowing Mastodon to display the author's fediverse profile when your content is shared. + --- ## Navigation diff --git a/templates/partials/header.html b/templates/partials/header.html index b008643d2..3d3c56f68 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -174,6 +174,11 @@ {%- include "partials/analytics.html" -%} {%- endif -%} + {# Socials #} + {%- if config.extra.fediverse_creator -%} + + {%- endif -%} + {# Search #} {%- if config.build_search_index -%} {%- if config.search.index_format -%} diff --git a/theme.toml b/theme.toml index 42add05a0..4b1b57e61 100644 --- a/theme.toml +++ b/theme.toml @@ -224,6 +224,11 @@ encode_plaintext_email = true # Setting is ignored if email is already encoded. # { name = "spotify", url = "https://open.spotify.com/artist/5Hv2bYBhMp1lUHFri06xkE", icon = "spotify" }, # ] +# Fediverse profile. +# Adds metadata to feature the author's profile in Mastodon link previews. +# Example: for @username@example.com, use: +# fediverse_creator = { handle = "username", domain = "example.com" } + # Extra menu to show on the footer, below socials section. # footer_menu = [ # {url = "about", name = "about", trailing_slash = true},