import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
// Canonical origin. Drives canonical URLs, OG tags, and the sitemap.
const SITE = process.env.PUBLIC_SITE_URL ?? 'https://adr.smlcompany.ca';
export default defineConfig({
site: SITE,
// Static output is the point of this rebuild — see docs/04-seo-spec.md.
// Do not switch to a server adapter without an AGENTS.md Change Log entry.
output: 'static',
// Directory-style URLs with a trailing slash, matched by the CloudFront
// trailing-slash function. See docs/06-deployment.md.
trailingSlash: 'always',
build: { format: 'directory', inlineStylesheets: 'auto' },
// Astro 7 changed this default from `true` to `'jsx'`. Measured, not assumed
// (AGENTS.md entry (t)): in an .astro template, an inline pair split across
// two lines renders as `inlinepair` under 'jsx' and
// `inline pair` under `true`. The space is silently
// deleted — no error, no warning; you find out by reading the page.
//
// MDX prose is NOT affected either way; the hazard is .astro markup only.
// Held at the HTML-aware behaviour because hand-written templates on a
// text-heavy site are exactly where a wrapped line meets an inline tag.
// Revisit only with a measurement, not a preference. See R12.
compressHTML: true,
integrations: [
mdx(),
sitemap({
// /legal/* is noindex by spec (docs/04) and nothing else is excluded.
// The `/type-scale/` half of this condition is gone with the page it
// named: the step-1 proof sheet was deleted at step 2, as its own comment
// and InfinityMark's both said it would be. Recoverable from git if the
// specimen is ever wanted again; it is not a route the site ships.
filter: (page) => !page.includes('/legal/'),
changefreq: 'monthly',
// No `lastmod`. It was `new Date()`, which stamped every URL with the
// build time — telling crawlers all 17 pages changed whenever one did.
// Google discounts lastmod it judges unreliable, so that spent the signal
// docs/04-seo-spec.md wants rather than sending it. Step 7 can reinstate
// it per-entry from an article's `updatedDate` via `serialize`.
}),
],
// No `image` block: `astro/assets/services/sharp` is already Astro's default
// service, so setting it was dead configuration. The conventions it used to
// sit under — explicit width/height on every image, never base64-inline —
// live in CLAUDE.md, which is where they are actually enforced (by review).
// No `prefetch` block at all — removed 2026-08-26, see AGENTS.md entry (r).
// Any prefetch setting ships Astro's prefetch script to every page, against
// CLAUDE.md's "default to zero JS", for a marginal gain on a small static site
// already served from CloudFront. Revisit only against real Lighthouse numbers.
});