fix(site): normalize SITE_URL to svemagie.net — migration domain fix
Build & Deploy / build-and-deploy (push) Failing after 1m16s
Build & Deploy / build-and-deploy (push) Failing after 1m16s
Gitea secret SITE_URL is stuck at blog.giersig.eu (API update returns 204 but value doesn't change). Normalize the old domain at read time so all discovery links, canonical URL, and fediverse:creator use svemagie.net. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+8
-5
@@ -5,6 +5,10 @@
|
|||||||
* All values have sensible defaults for initial deployment.
|
* 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")
|
// Parse social links from env (format: "name|url|icon,name|url|icon")
|
||||||
function parseSocialLinks(envVar) {
|
function parseSocialLinks(envVar) {
|
||||||
if (!envVar) return [];
|
if (!envVar) return [];
|
||||||
@@ -22,7 +26,7 @@ function getFediverseCreator() {
|
|||||||
// Primary: site's own ActivityPub actor (canonical fediverse identity)
|
// Primary: site's own ActivityPub actor (canonical fediverse identity)
|
||||||
const apHandle = process.env.ACTIVITYPUB_HANDLE;
|
const apHandle = process.env.ACTIVITYPUB_HANDLE;
|
||||||
if (apHandle) {
|
if (apHandle) {
|
||||||
const domain = (process.env.SITE_URL || "https://example.com").replace(/^https?:\/\//, "");
|
const domain = SITE_URL.replace(/^https?:\/\//, "");
|
||||||
return `@${apHandle}@${domain}`;
|
return `@${apHandle}@${domain}`;
|
||||||
}
|
}
|
||||||
// Fallback: external Mastodon account (syndication target)
|
// Fallback: external Mastodon account (syndication target)
|
||||||
@@ -56,15 +60,14 @@ function buildSocialFromFeeds() {
|
|||||||
}
|
}
|
||||||
const apHandle = process.env.ACTIVITYPUB_HANDLE;
|
const apHandle = process.env.ACTIVITYPUB_HANDLE;
|
||||||
if (apHandle) {
|
if (apHandle) {
|
||||||
const siteUrl = process.env.SITE_URL || "https://example.com";
|
links.push({ name: "ActivityPub", url: `${SITE_URL}/activitypub/users/${apHandle}`, rel: "me", icon: "activitypub" });
|
||||||
links.push({ name: "ActivityPub", url: `${siteUrl}/activitypub/users/${apHandle}`, rel: "me", icon: "activitypub" });
|
|
||||||
}
|
}
|
||||||
return links;
|
return links;
|
||||||
}
|
}
|
||||||
|
|
||||||
// site.url: no trailing slash — used as URL base for path concatenation ({{ site.url }}/path)
|
// 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
|
// 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 + "/";
|
const siteUrlWithSlash = siteUrlBase + "/";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -121,7 +124,7 @@ export default {
|
|||||||
|
|
||||||
// Webmentions configuration
|
// Webmentions configuration
|
||||||
webmentions: {
|
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)
|
// Fediverse creator for meta tag (e.g., @rick@rmendes.net)
|
||||||
|
|||||||
Reference in New Issue
Block a user