/** * Shared document shell for every rendered page. * * A page function returns `{title, description, body}`; `layout()` wraps it in * the `` document with the right meta, topnav, and footer. The brand mark * is inlined as SVG so pages do not fetch an image to render a 20-pixel logo. */ const BRAND_MARK = ``; const NAV = [ { href: '/browse', label: 'Browse' }, { href: '/submit', label: 'Submit' }, { href: '/publish', label: 'How publishing works' }, { href: '/boundaries', label: 'Boundaries' }, ]; /** * Compose a full HTML document from a page. * * @param {{title: string, description: string, body: string, here?: string}} page * @returns {string} the HTML document, ready to send. */ export function layout(page) { const { title, description, body, here = '' } = page; // The canonical URL is always on prometheus.x — never the IP+port the server // actually listens on, and never the SEO mirror at apps.silentmode.st, even // when the mirror is what served this request. Readers who followed a link // from search land on the mirror; the canonical sends search engines back to // the real address and keeps the scorecard on prometheus.x. const canonical = `https://prometheus.x${here}`; const navHtml = NAV.map(n => { const classAttr = n.href === here ? ' class="here"' : ''; return `${n.label}`; }).join('\n '); return `