From 95e3c528594f6137d7d8310c8e4231283c35933b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 10 Nov 2023 12:35:22 +0100 Subject: Template "elsewhere on the internet" links --- config.toml | 17 +++++++++++++++++ src/templates.ts | 10 ++++++++++ templates/homepage.html | 34 ++++------------------------------ 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/config.toml b/config.toml index a4345a0..82741ea 100644 --- a/config.toml +++ b/config.toml @@ -3,6 +3,7 @@ base_url = "https://alanpearce.eu" redirect_other_hostnames = true title = "Alan Pearce" +email = "alan@alanpearce.eu" description = "Developer, Emacs User" generate_feed = true @@ -49,3 +50,19 @@ content-security-policy = "default-src 'none'; img-src 'self'; object-src 'none' [[menus.main]] name = "Repositories" url = "https://git.alanpearce.eu" + +[[menus.me]] + name = "Codeberg" + url = "https://codeberg.org/alanpearce" +[[menus.me]] + name = "GitHub" + url = "https://github.com/alanpearce/" +[[menus.me]] + name = "GitLab" + url = "https://gitlab.com/alanpearce/" +[[menus.me]] + name = "Mastodon" + url = "https://ieji.de/@alanpearce" +[[menus.me]] + name = "BlueSky" + url = "https://bsky.app/profile/alanpearce.eu" diff --git a/src/templates.ts b/src/templates.ts index a134723..b8139f6 100644 --- a/src/templates.ts +++ b/src/templates.ts @@ -69,6 +69,16 @@ async function renderHomepage(posts: Array): Promise { .text(post.date.toISOString().slice(0, 10)); $post.appendTo($feed); } + + $(".u-email").attr("href", `mailto:${config.email}`).text(config.email); + const $elsewhere = $(".elsewhere"); + const $linkRelMe = $elsewhere.find(".u-url[rel=me]").parentsUntil("ul"); + $linkRelMe.remove(); + for (const link of config.menus.me) { + const $link = $linkRelMe.clone(); + $link.find("a").attr("href", link.url).text(link.name); + $link.appendTo($elsewhere); + } return $.html(); } diff --git a/templates/homepage.html b/templates/homepage.html index 1138e04..5004340 100644 --- a/templates/homepage.html +++ b/templates/homepage.html @@ -44,39 +44,13 @@

Elsewhere on the Internet

-
-- cgit 1.4.1