all repos — website @ 95e3c528594f6137d7d8310c8e4231283c35933b

My website

Template "elsewhere on the internet" links
Alan Pearce alan@alanpearce.eu
Fri, 10 Nov 2023 12:35:22 +0100
commit

95e3c528594f6137d7d8310c8e4231283c35933b

parent

9803beaca39fbccd38ab3a461a5e29d6e6d45c47

3 files changed, 31 insertions(+), 30 deletions(-)

jump to
M config.tomlconfig.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 @@ url = "/tags/" [[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"
M src/templates.tssrc/templates.ts
@@ -69,6 +69,16 @@ .attr("datetime", post.date.toISOString())       .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();
 }
 
M templates/homepage.htmltemplates/homepage.html
@@ -44,39 +44,13 @@ </ul>       </section>
       <section>
         <h2>Elsewhere on the Internet</h2>
-        <ul>
-          <li>
-            <a class="u-email" rel="me" href="mailto:alan@alanpearce.eu"
-              >alan@alanpearce.eu</a
-            >
-          </li>
-          <li>
-            <a class="u-url" rel="me" href="https://codeberg.org/alanpearce/"
-              >Codeberg</a
-            >
-          </li>
-          <li>
-            <a class="u-url" rel="me" href="https://github.com/alanpearce/"
-              >GitHub</a
-            >
-          </li>
+        <ul class="elsewhere">
           <li>
-            <a class="u-url" rel="me" href="https://gitlab.com/alanpearce/"
-              >GitLab</a
-            >
-          </li>
+            <a class="u-email" rel="me" href="mailto:user@example.com"
+            >user@example.com</a></li>
           <li>
-            <a class="u-url" rel="me" href="https://ieji.de/@alanpearce"
-              >Mastodon</a
-            >
+            <a class="u-url" rel="me" href="http://example.com">Example</a>
           </li>
-          <li>
-            <a
-              class="u-url"
-              rel="me"
-              href="https://bsky.app/profile/alanpearce.eu"
-              >Bluesky</a
-            >
           </li>
         </ul>
       </section>