feat: domain-based branding (humorunits.com / dickloads.com)
- src/lib/brand.ts: Brand config map, getBrand() reads hostname server-side - src/routes/+layout.server.ts: new, passes brand to layout - +layout.svelte: site name and footer driven by brand config - humorunits.com footer: 'invented conversions for ridiculous people' - dickloads.com footer: placeholder (pending Shannon's pick)
This commit is contained in:
32
src/lib/brand.ts
Normal file
32
src/lib/brand.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Brand configuration keyed by hostname (www-stripped).
|
||||
* Add new domains here — no other changes needed.
|
||||
*/
|
||||
export interface Brand {
|
||||
/** Site name shown in nav and page titles. */
|
||||
name: string;
|
||||
/** Footer tagline. */
|
||||
footer: string;
|
||||
}
|
||||
|
||||
const BRANDS: Record<string, Brand> = {
|
||||
'humorunits.com': {
|
||||
name: 'Humor Units',
|
||||
footer: 'Humor Units — invented conversions for ridiculous people.',
|
||||
},
|
||||
'dickloads.com': {
|
||||
name: 'Dick Loads',
|
||||
footer: 'Dick Loads — serious units for serious people.',
|
||||
},
|
||||
};
|
||||
|
||||
const DEFAULT_BRAND = BRANDS['humorunits.com'];
|
||||
|
||||
export function getBrand(requestUrl: string): Brand {
|
||||
try {
|
||||
const host = new URL(requestUrl).hostname.replace(/^www\./, '');
|
||||
return BRANDS[host] ?? DEFAULT_BRAND;
|
||||
} catch {
|
||||
return DEFAULT_BRAND;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user