- Privacy Policy (with cookies and storage) and Terms of Service, from what the code actually stores and loads; shared LegalText layout - Data requests: a 'privacy' feedback type sent from the Privacy page's form, email required, triaged in Admin -> Feedback - Migration 039: Panel -> Site settings -> Privacy contact email (over site.json's privacyEmail), shown on the Privacy page - The hero livestream, the hero featured video and schedule maps load only when pressed, so no third party sets anything before a click - A small dismissible privacy notice instead of a consent banner Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
56 lines
2.7 KiB
TypeScript
56 lines
2.7 KiB
TypeScript
/* ═══════════════════════════════════════════════════════════════
|
|
SITE
|
|
|
|
What the site says about itself, for the browser: /site.json, with
|
|
the admin's Site settings (Panel) laid over it. The server merges
|
|
the two and writes the result into each page's HTML as
|
|
window.__NGU_SITE__ (server/src/pageMeta.js), which is read here
|
|
before the app renders, so there's no request and no flash of the
|
|
old wording. In development, or if the API is down and nginx
|
|
serves the plain index.html, it isn't there and site.json alone
|
|
applies.
|
|
|
|
A page's visible heading and intro and its search title and
|
|
description come from the same values, so they can't drift.
|
|
|
|
SITE_ORIGIN is the public address of the live site. It's used
|
|
where a URL has to leave the browser and still work: a printed QR
|
|
code made on localhost or a preview has to point here, not at
|
|
wherever it was generated. Everything inside the site links by
|
|
path, not this.
|
|
═══════════════════════════════════════════════════════════════ */
|
|
|
|
import siteConfiguration from '../../site.json'
|
|
|
|
type PageText = { title: string; description: string }
|
|
|
|
type SiteText = { title?: string; pages?: Record<string, PageText>; privacyEmail?: string }
|
|
|
|
/* What the server wrote into the page, if it did. */
|
|
const fromServer: SiteText =
|
|
(typeof window !== 'undefined' && (window as unknown as { __NGU_SITE__?: SiteText }).__NGU_SITE__) || {}
|
|
|
|
export const SITE_NAME: string = fromServer.title || siteConfiguration.title
|
|
|
|
export const SITE_ORIGIN: string = siteConfiguration.url
|
|
|
|
/** Where privacy questions and data requests go (Panel → Site
|
|
* settings, else site.json). Blank: the Privacy page's form only. */
|
|
export const PRIVACY_EMAIL: string = fromServer.privacyEmail ?? siteConfiguration.privacyEmail
|
|
|
|
/** A site path as a full URL on the live site. */
|
|
export const siteUrl = (path: string): string => new URL(path, SITE_ORIGIN).href
|
|
|
|
const PAGES: Record<string, PageText> = { ...siteConfiguration.pages, ...fromServer.pages }
|
|
|
|
/** A static page's title and intro, from site.json's "pages". */
|
|
export function sitePage(path: string): PageText {
|
|
const page = PAGES[path]
|
|
if (!page) throw new Error(`site.json has no "pages" entry for ${path}`)
|
|
return page
|
|
}
|
|
|
|
/** The browser tab's title for a page: "Retreats | Next Generation
|
|
* of Unity", or the site name alone for the home page. */
|
|
export const documentTitle = (title?: string | null): string =>
|
|
title ? `${title} | ${SITE_NAME}` : SITE_NAME
|