File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,6 +34,19 @@ const fullTitle =
3434const ogImage = image || (siteConfig .defaultOgImage as ImageMetadata | undefined );
3535const imageURL = ogImage ? new URL (ogImage .src , Astro .url ).href : undefined ;
3636const 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 />
You can’t perform that action at this time.
0 commit comments