Files

19 lines
469 B
TypeScript

/**
* The public origin of this site, used as Next's `metadataBase`.
*/
const DEVELOPMENT_FALLBACK = 'http://localhost:3000';
export function siteUrl(): URL {
const configured = process.env['SITE_URL']?.trim();
if (configured) {
return new URL(configured);
}
if (process.env.NODE_ENV === 'production') {
console.error('SITE_URL is not set — canonical and Open Graph URLs will point at localhost.');
}
return new URL(DEVELOPMENT_FALLBACK);
}