beeeeg update
Some checks failed
Test and deploy staging / staging (push) Has been cancelled

This commit is contained in:
2026-09-23 04:15:10 +00:00
parent 487eff5bb2
commit d0c7b6548b
135 changed files with 9531 additions and 1777 deletions

View File

@@ -1,9 +1,40 @@
import { dev } from "$app/env";
export type SiteEnvironment = 'DEV' | 'STAGING' | null;
export function getTitle(path: string): string {
let builtTitle = "Stan Runge";
if (dev) builtTitle = "(DEV) " + builtTitle;
return builtTitle;
export function siteEnvironment(isDev: boolean, origin?: string): SiteEnvironment {
if (isDev) return 'DEV';
try {
return new URL(origin ?? '').hostname === 'staging.stanrunge.dev' ? 'STAGING' : null;
} catch {
return null;
}
}
export function formatTitle(title: string, environment: SiteEnvironment = null): string {
return `${environment ? `(${environment}) ` : ''}${title} | Stan Runge`;
}
export function getTitle(path: string, environment: SiteEnvironment = null): string {
const titles: Record<string, string> = {
'/': 'Home',
'/projects': 'Projects',
'/blog': 'Blog',
'/lists': 'Lists',
'/login': 'Sign in',
'/register': 'Register',
'/account': 'Account',
'/projects/catch-em-all': 'Catchemall',
'/projects/animaldex': 'Animaldex',
'/projects/animaldex/register': 'Log a sighting',
'/projects/animaldex/admin': 'Animaldex admin',
'/projects/derby': 'Derby Lens',
'/projects/cs-prices': 'CS Prices',
'/projects/game-tracker': 'Game Tracker',
'/projects/money-tracker': 'Money Tracker',
'/projects/spotify-beatmap-finder': 'osu! map finder',
'/projects/progress': 'Progress'
};
const cleaned = path.replace(/\/$/, '') || '/';
const title =
titles[cleaned] ?? cleaned.split('/').filter(Boolean).at(-1)?.replace(/-/g, ' ') ?? 'Home';
return formatTitle(title, environment);
}