Skip to content

Commit

Permalink
✨ feat: add fediverse creator metadata support (#409)
Browse files Browse the repository at this point in the history
Add `fediverse_creator` variable to highlight author's fediverse profile in Mastodon link previews.

Co-authored-by: Ariel Richtman <[email protected]>
Co-authored-by: welpo <[email protected]>
  • Loading branch information
3 people authored Oct 10, 2024
1 parent 3fddb1f commit 886aa59
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 @[email protected], 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},
Expand Down
12 changes: 12 additions & 0 deletions content/blog/mastering-tabi-settings/index.ca.md
Original file line number Diff line number Diff line change
Expand Up @@ -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ó
Expand Down
12 changes: 12 additions & 0 deletions content/blog/mastering-tabi-settings/index.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions content/blog/mastering-tabi-settings/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions templates/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@
{%- include "partials/analytics.html" -%}
{%- endif -%}

{# Socials #}
{%- if config.extra.fediverse_creator -%}
<meta name="fediverse:creator" content="@{{ config.extra.fediverse_creator["handle"] }}@{{ config.extra.fediverse_creator["domain"]}}" />
{%- endif -%}

{# Search #}
{%- if config.build_search_index -%}
{%- if config.search.index_format -%}
Expand Down
5 changes: 5 additions & 0 deletions theme.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 @[email protected], 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},
Expand Down

0 comments on commit 886aa59

Please sign in to comment.