// SEO: head-tags per pagina en voor de hele site, plus gestructureerde data. // Titels en beschrijvingen staan in het pagina-register (sitePages.ts). import type { SiteContent } from './content/types.ts'; import { visibleSocials } from './lib/visibleSocials.ts'; import type { RoutePath } from './navigation.ts'; import sitePages from './sitePages.ts'; export const siteUrl = 'https://andreaslop.nl'; export const siteName = 'Andrea Slop Fotografie'; // Preview-afbeelding voor WhatsApp, Facebook en LinkedIn (public/og-image.jpg) export const defaultOgImage = { path: '/og-image.jpg', width: 1200, height: 630, alt: 'Takjes paarse heide op een arm met een bloementattoo', }; // Absolute URL zonder slash aan het eind (behalve de homepage), zonder query // of hash (BR-SEO-02) export function canonicalUrl(path: string, base: string = siteUrl): string { const clean = path.split(/[?#]/)[0].replace(/\/+$/, ''); if (clean === '') { return `${base}/`; } return base + (clean.startsWith('/') ? clean : `/${clean}`); } // Head-tags van een pagina uit het register (BR-SEO-01 t/m 04) export function pageHead(path: RoutePath) { const page = sitePages[path]; const title = `${page.title} | ${siteName}`; const url = canonicalUrl(path); const image = page.ogImage ?? defaultOgImage; return { meta: [ { title }, { name: 'description', content: page.description }, // noindex voor placeholders, tot de echte pagina live gaat ...(page.indexed ? [] : [{ name: 'robots', content: 'noindex' }]), // Voor link-previews (WhatsApp, Facebook, LinkedIn) { property: 'og:title', content: title }, { property: 'og:description', content: page.description }, { property: 'og:url', content: url }, { property: 'og:image', content: siteUrl + image.path }, { property: 'og:image:alt', content: image.alt }, { property: 'og:image:width', content: String(image.width) }, { property: 'og:image:height', content: String(image.height) }, ], links: [{ rel: 'canonical', href: url }], }; } // JSON voor een