From 62e3e644e8ad7156a5c76f382cb4607542414266 Mon Sep 17 00:00:00 2001 From: MTRNord Date: Sat, 14 Dec 2024 18:35:12 +0100 Subject: [PATCH 1/2] Allow setting author metadata and merge author aliases This allows to set a canonical name of people which have multiple aliases used as authors. It will keep links intact and just merge the posts as needed. It also updates the links in the posts to the correct name and slug. Additionally this feature allows for a description on the author page to exist to introduce a person. Last but not least this allows setting a mastaodon uri to allow using the fediverse:creator meta tag --- content/authors.toml | 30 ++++++++++++++++ templates/blog.html | 18 +++++++--- templates/post.html | 51 +++++++++++++++++++++------ templates/taxonomy_list.html | 64 ++++++++++++++++++++++++++++++++-- templates/taxonomy_single.html | 47 ++++++++++++++++++++++--- 5 files changed, 188 insertions(+), 22 deletions(-) create mode 100644 content/authors.toml diff --git a/content/authors.toml b/content/authors.toml new file mode 100644 index 000000000..920c7a5cc --- /dev/null +++ b/content/authors.toml @@ -0,0 +1,30 @@ +[author.josh_simmons] +name = "Josh Simmons" +description = """ + +""" +aliases = ["Josh Simmons (m.org)"] +mastodon = "@josh@josh.tel" + +[author.thib] +name = "Thib" +description = """ + +""" +aliases = ["Thib (m.org)"] +mastodon = "@thibaultamartin@mamot.fr" + +[author.matthew] +name = "Matthew Hodgson" +description = """ + +""" +aliases = [] +mastodon = "@matthew@mastodon.matrix.org" + +[author.mtrnord] +name = "MTRNord" +description = """ +""" +aliases = ["MTRNord (they/them)"] +mastodon = "@mtrnord@mastodon.mtrnord.blog" diff --git a/templates/blog.html b/templates/blog.html index 81a6e6379..b9ce6284d 100644 --- a/templates/blog.html +++ b/templates/blog.html @@ -16,11 +16,19 @@

{{ page.title }} {%- if not loop.last %}, {% endif %}{% endfor %} {% endif %} — - {% for author in page.taxonomies.author %} - - {{- author | default(value=["unknown author"]) -}} - - {%- if not loop.last %}, {% endif %} + {% set authors = load_data(path="content/authors.toml") %} + {% set author_details = authors.author %} + {% for author_alias in page.taxonomies.author %} + {% set_global author_name = author_alias %} + {% for key, value in author_details %} + {% if value.name == author_alias or author_alias in value.aliases %} + {% set_global author_name = value.name %} + {% endif %} + {% endfor %} + + {{- author_name -}} + + {%- if not loop.last %}, {% endif %} {% endfor %} {% if page.updated -%} diff --git a/templates/post.html b/templates/post.html index f095864fb..aea830d77 100644 --- a/templates/post.html +++ b/templates/post.html @@ -10,6 +10,25 @@ {{ throw(message="Please put author under the taxonomies area.") }} {%- endif -%} +{% set authors = load_data(path="content/authors.toml") %} +{% set author_details = authors.author %} +{% set author_meta = [] %} +{% for author_alias in page.taxonomies.author %} + {% set_global author_name = author_alias %} + {% for key, value in author_details %} + {% if value.name == author_alias or author_alias in value.aliases %} + {% set_global author_name = value.name %} + {% set_global author_meta = author_meta | concat(with=value) %} + {% endif %} + {% endfor %} +{% endfor %} + +{% for author in author_meta %} + {% if author.mastodon %} + + {% endif %} +{% endfor %} +