feat: use AP handle as primary fediverse identity

Rename getMastodonHandle() to getFediverseCreator() and prefer the
site's own ActivityPub handle (ACTIVITYPUB_HANDLE) over the external
Mastodon account for the fediverse:creator meta tag. The Mastodon
account is a syndication target, not the canonical identity.
This commit is contained in:
Ricardo
2026-02-24 12:08:02 +01:00
parent 2c172566c8
commit 90ff9068a1

View File

@@ -16,8 +16,16 @@ function parseSocialLinks(envVar) {
});
}
// Get Mastodon handle for fediverse:creator meta tag
function getMastodonHandle() {
// Get fediverse handle for fediverse:creator meta tag
// Prefers the site's own ActivityPub identity over external Mastodon account
function getFediverseCreator() {
// Primary: site's own ActivityPub actor (canonical fediverse identity)
const apHandle = process.env.ACTIVITYPUB_HANDLE;
if (apHandle) {
const domain = (process.env.SITE_URL || "https://example.com").replace(/^https?:\/\//, "");
return `@${apHandle}@${domain}`;
}
// Fallback: external Mastodon account (syndication target)
const instance = process.env.MASTODON_INSTANCE?.replace("https://", "") || "";
const user = process.env.MASTODON_USER || "";
if (instance && user) {
@@ -104,8 +112,8 @@ export default {
domain: process.env.SITE_URL?.replace("https://", "").replace("http://", "") || "example.com",
},
// Fediverse creator for meta tag (e.g., @rmdes@mstdn.social)
fediverseCreator: getMastodonHandle(),
// Fediverse creator for meta tag (e.g., @rick@rmendes.net)
fediverseCreator: getFediverseCreator(),
// Support/monetization configuration (used in _textcasting JSON Feed extension)
support: {