From 0c9941cab29b829552437dc1c04b47c89f4fcb56 Mon Sep 17 00:00:00 2001 From: "dobby-yivi-agent[bot]" <275734547+dobby-yivi-agent[bot]@users.noreply.github.com> Date: Thu, 4 Jun 2026 23:44:24 +0000 Subject: [PATCH] refactor: extract hardcoded postguard.eu URL into SITE_URL constant Replace 24+ literal 'https://postguard.eu' across 13 files with a single SITE_URL exported from src/lib/env.ts, using the runtimeConfig mechanism that BUSINESS_URL already follows so staging/dev can override without a rebuild on non-prerendered routes. Closes #252 --- src/lib/authors.ts | 8 +++++--- src/lib/components/SEO.svelte | 6 +++--- src/lib/env.ts | 2 ++ src/routes/(app)/decrypt/+page.svelte | 5 +++-- src/routes/(app)/fileshare/+page.svelte | 5 +++-- src/routes/(marketing)/+page.svelte | 18 +++++++++--------- src/routes/(marketing)/about/+page.svelte | 9 +++++---- src/routes/(marketing)/addons/+page.svelte | 13 +++++++------ src/routes/(marketing)/blog/+page.svelte | 12 ++++++------ .../(marketing)/blog/[slug]/+page.svelte | 14 +++++++------- src/routes/(marketing)/blog/rss.xml/+server.js | 3 ++- src/routes/(marketing)/privacy/+page.svelte | 11 ++++++----- src/routes/robots.txt/+server.js | 4 +++- src/routes/sitemap.xml/+server.js | 4 +++- 14 files changed, 64 insertions(+), 50 deletions(-) diff --git a/src/lib/authors.ts b/src/lib/authors.ts index cfd2765..5b74d2e 100644 --- a/src/lib/authors.ts +++ b/src/lib/authors.ts @@ -1,3 +1,5 @@ +import { SITE_URL } from '$lib/env' + export interface Author { name: string role?: string @@ -21,12 +23,12 @@ export const authors: Record = { image: 'https://github.com/rubenhensen.png', github: 'https://github.com/rubenhensen', linkedin: 'https://linkedin.com/in/rubenhensen', - url: 'https://postguard.eu/about', + url: `${SITE_URL}/about`, }, } /** Look up an author by name, falling back to a generic entry. */ export function getAuthor(name: string | undefined): Author { - if (!name) return { name: 'PostGuard', url: 'https://postguard.eu' } - return authors[name] ?? { name, url: 'https://postguard.eu/about' } + if (!name) return { name: 'PostGuard', url: SITE_URL } + return authors[name] ?? { name, url: `${SITE_URL}/about` } } diff --git a/src/lib/components/SEO.svelte b/src/lib/components/SEO.svelte index c31bc08..a9a3982 100644 --- a/src/lib/components/SEO.svelte +++ b/src/lib/components/SEO.svelte @@ -1,5 +1,6 @@ diff --git a/src/lib/env.ts b/src/lib/env.ts index dbcbdc6..8558ed6 100644 --- a/src/lib/env.ts +++ b/src/lib/env.ts @@ -29,6 +29,8 @@ function runtimeConfig(): Record { export const FF_BUSINESS = runtimeConfig().FF_BUSINESS === true export const BUSINESS_URL = (runtimeConfig().BUSINESS_URL as string) ?? 'https://business.postguard.eu' +export const SITE_URL: string = + (runtimeConfig().SITE_URL as string) ?? 'https://postguard.eu' /** True on staging/dev where cryptify runs with `staging_mode = true` and * does not actually send notification emails. The website uses this to diff --git a/src/routes/(app)/decrypt/+page.svelte b/src/routes/(app)/decrypt/+page.svelte index e6fe4ec..3d1fe69 100644 --- a/src/routes/(app)/decrypt/+page.svelte +++ b/src/routes/(app)/decrypt/+page.svelte @@ -12,6 +12,7 @@ import { _ } from 'svelte-i18n' import { resolve } from '$app/paths' + import { SITE_URL } from '$lib/env' import EmailView from '$lib/components/fallback/EmailView.svelte' import ListView from '$lib/components/fallback/ListView.svelte' @@ -124,12 +125,12 @@ '@context': 'https://schema.org', '@type': 'WebApplication', name: 'PostGuard Email Decryption', - url: 'https://postguard.eu/decrypt', + url: `${SITE_URL}/decrypt`, description: 'Decrypt PostGuard-encrypted emails securely in your browser using the Yivi identity wallet.', applicationCategory: 'SecurityApplication', operatingSystem: 'Any', - isPartOf: { '@id': 'https://postguard.eu/#website' }, + isPartOf: { '@id': `${SITE_URL}/#website` }, }} /> diff --git a/src/routes/(app)/fileshare/+page.svelte b/src/routes/(app)/fileshare/+page.svelte index d0f7780..b264970 100644 --- a/src/routes/(app)/fileshare/+page.svelte +++ b/src/routes/(app)/fileshare/+page.svelte @@ -12,6 +12,7 @@ import ErrorPanel from '$lib/components/filesharing/Error.svelte' import Done from '$lib/components/filesharing/Done.svelte' import CrashReport from '$lib/components/filesharing/CrashReport.svelte' + import { SITE_URL } from '$lib/env' const ATTRIBUTES: Array = [ 'pbdf.sidn-pbdf.mobilenumber.mobilenumber', @@ -56,7 +57,7 @@ '@context': 'https://schema.org', '@type': 'WebApplication', name: 'PostGuard Secure File Sharing', - url: 'https://postguard.eu/fileshare', + url: `${SITE_URL}/fileshare`, description: 'Send end-to-end encrypted files to anyone using their email address. Encryption happens entirely in your browser.', applicationCategory: 'SecurityApplication', @@ -67,7 +68,7 @@ priceCurrency: 'EUR', }, isPartOf: { - '@id': 'https://postguard.eu/#website', + '@id': `${SITE_URL}/#website`, }, } diff --git a/src/routes/(marketing)/+page.svelte b/src/routes/(marketing)/+page.svelte index d248639..de1e592 100644 --- a/src/routes/(marketing)/+page.svelte +++ b/src/routes/(marketing)/+page.svelte @@ -3,7 +3,7 @@ import { _ } from 'svelte-i18n' import { resolve } from '$app/paths' import SEO from '$lib/components/SEO.svelte' - import { FF_BUSINESS } from '$lib/env' + import { FF_BUSINESS, SITE_URL } from '$lib/env' let contactEl: HTMLAnchorElement @@ -20,13 +20,13 @@ '@graph': [ { '@type': 'WebSite', - '@id': 'https://postguard.eu/#website', - url: 'https://postguard.eu', + '@id': `${SITE_URL}/#website`, + url: SITE_URL, name: 'PostGuard', description: 'Free, open-source end-to-end encryption for emails and files.', publisher: { - '@id': 'https://postguard.eu/#organization', + '@id': `${SITE_URL}/#organization`, }, }, { @@ -41,23 +41,23 @@ price: '0', priceCurrency: 'EUR', }, - url: 'https://postguard.eu', + url: SITE_URL, license: 'https://opensource.org/licenses/MIT', softwareRequirements: 'Yivi (IRMA) app', author: { - '@id': 'https://postguard.eu/#organization', + '@id': `${SITE_URL}/#organization`, }, }, { '@type': 'Organization', - '@id': 'https://postguard.eu/#organization', + '@id': `${SITE_URL}/#organization`, name: 'PostGuard', - url: 'https://postguard.eu', + url: SITE_URL, description: 'Free, open-source identity-based encryption for emails and files.', logo: { '@type': 'ImageObject', - url: 'https://postguard.eu/pg_logo.png', + url: `${SITE_URL}/pg_logo.png`, width: 512, height: 512, }, diff --git a/src/routes/(marketing)/about/+page.svelte b/src/routes/(marketing)/about/+page.svelte index ab70be0..d6d59b9 100644 --- a/src/routes/(marketing)/about/+page.svelte +++ b/src/routes/(marketing)/about/+page.svelte @@ -2,18 +2,19 @@ import { _ } from 'svelte-i18n' import aboutImg from '$lib/assets/images/about.svg' import SEO from '$lib/components/SEO.svelte' + import { SITE_URL } from '$lib/env' const aboutJsonLd = { '@context': 'https://schema.org', '@graph': [ { '@type': 'AboutPage', - url: 'https://postguard.eu/about', + url: `${SITE_URL}/about`, name: 'About PostGuard', description: 'Learn how PostGuard uses identity-based encryption and the Yivi app to provide free, easy-to-use end-to-end encryption for emails and files.', isPartOf: { - '@id': 'https://postguard.eu/#website', + '@id': `${SITE_URL}/#website`, }, }, { @@ -23,13 +24,13 @@ '@type': 'ListItem', position: 1, name: 'Home', - item: 'https://postguard.eu', + item: SITE_URL, }, { '@type': 'ListItem', position: 2, name: 'About PostGuard', - item: 'https://postguard.eu/about', + item: `${SITE_URL}/about`, }, ], }, diff --git a/src/routes/(marketing)/addons/+page.svelte b/src/routes/(marketing)/addons/+page.svelte index e44f7c1..13e86f4 100644 --- a/src/routes/(marketing)/addons/+page.svelte +++ b/src/routes/(marketing)/addons/+page.svelte @@ -5,6 +5,7 @@ // import { fade } from 'svelte/transition' import { Tween } from 'svelte/motion' import { cubicOut } from 'svelte/easing' + import { SITE_URL } from '$lib/env' import tbLogo from '$lib/assets/images/tb_logo.svg' import olLogo from '$lib/assets/images/ol_logo.svg' @@ -25,13 +26,13 @@ '@type': 'ListItem', position: 1, name: 'Home', - item: 'https://postguard.eu', + item: SITE_URL, }, { '@type': 'ListItem', position: 2, name: 'Addons', - item: 'https://postguard.eu/addons', + item: `${SITE_URL}/addons`, }, ], }, @@ -47,12 +48,12 @@ price: '0', priceCurrency: 'EUR', }, - url: 'https://postguard.eu/addons', + url: `${SITE_URL}/addons`, softwareRequirements: 'Mozilla Thunderbird, Yivi app', author: { '@type': 'Organization', name: 'PostGuard', - url: 'https://postguard.eu', + url: SITE_URL, }, }, { @@ -67,12 +68,12 @@ price: '0', priceCurrency: 'EUR', }, - url: 'https://postguard.eu/addons', + url: `${SITE_URL}/addons`, softwareRequirements: 'Microsoft Outlook, Yivi app', author: { '@type': 'Organization', name: 'PostGuard', - url: 'https://postguard.eu', + url: SITE_URL, }, }, ], diff --git a/src/routes/(marketing)/blog/+page.svelte b/src/routes/(marketing)/blog/+page.svelte index 7b73e53..929410c 100644 --- a/src/routes/(marketing)/blog/+page.svelte +++ b/src/routes/(marketing)/blog/+page.svelte @@ -1,21 +1,21 @@ diff --git a/src/routes/(marketing)/blog/rss.xml/+server.js b/src/routes/(marketing)/blog/rss.xml/+server.js index 6ead9b9..cc2edf3 100644 --- a/src/routes/(marketing)/blog/rss.xml/+server.js +++ b/src/routes/(marketing)/blog/rss.xml/+server.js @@ -1,6 +1,7 @@ +import { SITE_URL } from '$lib/env' + export const prerender = true -const SITE_URL = 'https://postguard.eu' const FEED_URL = `${SITE_URL}/blog/rss.xml` const FEED_TITLE = 'PostGuard Blog' const FEED_DESCRIPTION = diff --git a/src/routes/(marketing)/privacy/+page.svelte b/src/routes/(marketing)/privacy/+page.svelte index a2a8253..983f2c9 100644 --- a/src/routes/(marketing)/privacy/+page.svelte +++ b/src/routes/(marketing)/privacy/+page.svelte @@ -1,6 +1,7 @@