Skip to content

Commit ff6214b

Browse files
committed
SEO updates
1 parent 8846056 commit ff6214b

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/components/organisms/Head.astro

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ const fullTitle =
3434
const ogImage = image || (siteConfig.defaultOgImage as ImageMetadata | undefined);
3535
const imageURL = ogImage ? new URL(ogImage.src, Astro.url).href : undefined;
3636
const imageAlt = `${siteName} — ${siteConfig.description}`;
37+
38+
// Derive `@user@instance` from a Mastodon profile URL (e.g. https://mastodon.social/@tingeber)
39+
const mastodonUrl = siteConfig.social?.mastodon;
40+
const fediverseCreator = (() => {
41+
if (!mastodonUrl) return undefined;
42+
try {
43+
const u = new URL(mastodonUrl);
44+
const handle = u.pathname.replace(/^\/+/, '').replace(/^@/, '');
45+
return handle ? `@${handle}@${u.hostname}` : undefined;
46+
} catch {
47+
return undefined;
48+
}
49+
})();
3750
---
3851

3952
<meta charset="utf-8" />
@@ -69,6 +82,9 @@ const imageAlt = `${siteName} — ${siteConfig.description}`;
6982
{imageURL && <meta name="twitter:image" content={imageURL} />}
7083
{imageURL && <meta name="twitter:image:alt" content={imageAlt} />}
7184

85+
<!-- Mastodon (Fediverse) author byline -->
86+
{fediverseCreator && <meta name="fediverse:creator" content={fediverseCreator} />}
87+
7288
<!-- Local Font Declaration -->
7389
<Font cssVariable="--font-source-serif-4" preload />
7490
<Font cssVariable="--font-fraunces" preload />

0 commit comments

Comments
 (0)