From 7cbec566eb01c018f78f1eed191d6f4bf316918c Mon Sep 17 00:00:00 2001
From: Cory Dransfeldt <hi@coryd.dev>
Date: Mon, 29 Jan 2024 11:53:00 -0800
Subject: [PATCH] chore: masto links to shared blog posts in post detail view

---
 src/_includes/post.liquid | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/_includes/post.liquid b/src/_includes/post.liquid
index 48e11e4f..a42089be 100644
--- a/src/_includes/post.liquid
+++ b/src/_includes/post.liquid
@@ -3,6 +3,8 @@ layout: main
 schema: blog
 ---
 {% render "partials/header.liquid", meta: meta, page: page, nav: nav %}
+{%- capture postUrl %}{{ meta.url }}{{ page.url }}{% endcapture -%}
+{%- assign shareLink = postUrl | findPost: linkPosts -%}
 {% capture css %}
   {% render "../assets/styles/plugins/prism.css" %}
   {% render "../assets/styles/pages/post.css" %}
@@ -12,7 +14,14 @@ schema: blog
   <article class="h-entry" data-pagefind-body>
     <h2 class="p-name" data-pagefind-meta="title">{{ title }}</h2>
     <span class="p-author h-card hidden">{{ meta.author }}</span>
-    <time class="dt-published" datetime="{{ date }}">{{ date | readableDate }}</time>
+    <div class="flex--centered">
+      <time class="dt-published" datetime="{{ date }}">{{ date | readableDate }}</time>
+      {%- if shareLink %}
+        <a class="brand-mastodon icon--small icon--center__vertical" href="{{ shareLink }}">
+          {% tablericon "brand-mastodon" "Mastodon post" %}
+        </a>
+      {% endif -%}
+    </div>
     <div class="p-summary hidden">{{ post_excerpt }}</div>
     <div class="e-content">
       {% render "partials/banner-old-post.liquid", date: date %}