From f0f5bfa50044c526ae56bc49a43319d137ffe0c3 Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Wed, 9 Oct 2024 20:05:37 +0200 Subject: [PATCH] Add more detailed author data --- authors.json | 4 +++- config.toml | 2 +- templates/atom.xml | 46 ++++++++++++++++++++++++++++++++++++++++ templates/base.html | 2 ++ templates/blog/post.html | 7 ++++++ 5 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 templates/atom.xml diff --git a/authors.json b/authors.json index d72038a9..df9b7096 100644 --- a/authors.json +++ b/authors.json @@ -1,6 +1,8 @@ { "nik": { - "display_name": "Nik" + "display_name": "Nik", + "email": "dominik.george@teckids.org", + "fediverse": "@nik@toot.teckids.org" }, "pinguin": { "display_name": "Pingu" diff --git a/config.toml b/config.toml index a3ef8351..26143fab 100644 --- a/config.toml +++ b/config.toml @@ -20,7 +20,6 @@ taxonomies = [ { name = "produkt", render = false, feed = false }, { name = "tags", render = false }, - ] [markdown] @@ -30,6 +29,7 @@ external_links_target_blank = true external_links_no_referrer = true [slugify] +taxonomies = "on" #paths_keep_dates = true [search] diff --git a/templates/atom.xml b/templates/atom.xml new file mode 100644 index 00000000..d4a2dd2a --- /dev/null +++ b/templates/atom.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ lang }}"> + <title>{{ config.title }} + {%- if term %} - {{ term.name }} + {%- elif section.title %} - {{ section.title }} + {%- endif -%} + </title> + {%- if config.description %} + <subtitle>{{ config.description }}</subtitle> + {%- endif %} + <link rel="self" type="application/atom+xml" href="{{ feed_url | safe }}"/> + <link rel="alternate" type="text/html" href=" + {%- if section -%} + {{ section.permalink | escape_xml | safe }} + {%- else -%} + {{ config.base_url | escape_xml | safe }} + {%- endif -%} + "/> + <generator uri="https://www.getzola.org/">Zola</generator> + <updated>{{ last_updated | date(format="%+") }}</updated> + <id>{{ feed_url | safe }}</id> + {%- for page in pages %} + {% set authors_data = load_data(path="authors.json") -%} + <entry xml:lang="{{ page.lang }}"> + <title>{{ page.title }}</title> + <published>{{ page.date | date(format="%+") }}</published> + <updated>{{ page.updated | default(value=page.date) | date(format="%+") }}</updated> + {% for author in page.authors %} + <author> + <name>{{ authors_data[author].display_name }}</name> + <uri>https://teckids.org/authors/{{ author }}/</uri> + {% if authors_data[author].email -%} + <email>{{ authors_data[author].email }}</email> + {% endif -%} + </author> + {% endfor %} + <link rel="alternate" type="text/html" href="{{ page.permalink | safe }}"/> + <id>{{ page.permalink | safe }}</id> + {% if page.summary %} + <summary type="html">{{ page.summary }}</summary> + {% else %} + <content type="html" xml:base="{{ page.permalink | escape_xml | safe }}">{{ page.content }}</content> + {% endif %} + </entry> + {%- endfor %} +</feed> diff --git a/templates/base.html b/templates/base.html index 0eaba4a1..40852e86 100644 --- a/templates/base.html +++ b/templates/base.html @@ -15,6 +15,8 @@ <link rel="alternate" type="application/atom+xml" href="{{ get_url(path="atom.xml", trailing_slash=false) }}" /> {% endblock %} + {% block meta_extra %}{% endblock %} + {% block og %} <meta property="og:site_name" content="{{ config.title }}" /> {% if thing %} diff --git a/templates/blog/post.html b/templates/blog/post.html index e0bc6dc1..52397bbc 100644 --- a/templates/blog/post.html +++ b/templates/blog/post.html @@ -2,6 +2,13 @@ {% block rdfa_type %}schema:BlogPosting{% endblock %} +{% block meta_extra %} + {% set authors_data = load_data(path="authors.json") -%} + {% if authors_data[page.authors.0].fediverse %} + <meta name="fediverse:creator" content="{{ authors_data[page.authors.0].fediverse }}" /> + {% endif %} +{% endblock %} + {% block content %} {% set blog_section = get_section(path="blog/_index.md") %} {% set post = page -%} -- GitLab