diff --git a/_data/site.js b/_data/site.js index a52b165..3a0442f 100644 --- a/_data/site.js +++ b/_data/site.js @@ -5,6 +5,10 @@ * All values have sensible defaults for initial deployment. */ +// Normalize site URL — replaces old domain after migration (secret may not be updated yet) +const SITE_URL = (process.env.SITE_URL || "https://svemagie.net") + .replace("blog.giersig.eu", "svemagie.net"); + // Parse social links from env (format: "name|url|icon,name|url|icon") function parseSocialLinks(envVar) { if (!envVar) return []; @@ -22,7 +26,7 @@ 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?:\/\//, ""); + const domain = SITE_URL.replace(/^https?:\/\//, ""); return `@${apHandle}@${domain}`; } // Fallback: external Mastodon account (syndication target) @@ -56,15 +60,14 @@ function buildSocialFromFeeds() { } const apHandle = process.env.ACTIVITYPUB_HANDLE; if (apHandle) { - const siteUrl = process.env.SITE_URL || "https://example.com"; - links.push({ name: "ActivityPub", url: `${siteUrl}/activitypub/users/${apHandle}`, rel: "me", icon: "activitypub" }); + links.push({ name: "ActivityPub", url: `${SITE_URL}/activitypub/users/${apHandle}`, rel: "me", icon: "activitypub" }); } return links; } // site.url: no trailing slash — used as URL base for path concatenation ({{ site.url }}/path) // site.me / site.author.url: trailing slash — Mastodon rel="me" requires exact match -const siteUrlBase = (process.env.SITE_URL || "https://example.com").replace(/\/$/, ""); +const siteUrlBase = SITE_URL.replace(/\/$/, ""); const siteUrlWithSlash = siteUrlBase + "/"; export default { @@ -121,7 +124,7 @@ export default { // Webmentions configuration webmentions: { - domain: process.env.SITE_URL?.replace("https://", "").replace("http://", "") || "example.com", + domain: SITE_URL.replace("https://", "").replace("http://", ""), }, // Fediverse creator for meta tag (e.g., @rick@rmendes.net)