From c963e3476622455124cfed9b90de4346a3a7dbc1 Mon Sep 17 00:00:00 2001 From: mifi Date: Mon, 16 Feb 2026 01:18:38 -0300 Subject: [PATCH] Proper 410/404 pages --- AGENTS.md | 75 +++++++++++++++++++++++++ eslint.config.js | 1 + nginx.conf | 27 ++++++++- package.json | 4 +- scripts/copy-410-paths.mjs | 39 +++++++++++++ static/404.html | 20 +++++++ static/410.html | 20 +++++++ static/assets/error-pages.css | 102 ++++++++++++++++++++++++++++++++++ 8 files changed, 284 insertions(+), 4 deletions(-) create mode 100644 AGENTS.md create mode 100644 scripts/copy-410-paths.mjs create mode 100644 static/404.html create mode 100644 static/410.html create mode 100644 static/assets/error-pages.css diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..3ea0d38 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,75 @@ +# Agent guide: mifi Ventures landing + +This file helps LLM agents work in this repo without introducing anti-patterns. Follow the architecture and conventions below. + +## Purpose + +- **Audience**: LLM agents (e.g. Cursor, Codex) making code or content changes. +- **Goal**: Preserve a minimal static site: SvelteKit prerender, no client-side app JS, shared theming, critical CSS inlining, and clear separation between app routes and static error pages. + +## Stack and architecture + +- **Framework**: SvelteKit with **adapter-static**. All routes are prerendered; there is no client-side router or hydration (`csr: false` in `src/routes/+layout.ts`). +- **Build**: `pnpm run build` = `vite build` → `node scripts/critters.mjs` → `node scripts/minify-static-js.mjs` → `node scripts/copy-410-paths.mjs`. Output is `dist/` (static files only). +- **Runtime**: nginx serves `dist/` (mounted as `/usr/share/nginx/html` in the container). No Node at runtime. +- **Theming**: CSS only. Light/dark follows **system preference** via `@media (prefers-color-scheme: dark)` in `src/app.css`. There is no JS theme toggle or `data-theme`; do not add one unless explicitly requested. +- **Fonts**: **Local only.** Inter and Fraunces are served from `static/assets/fonts/` (e.g. `inter-v20-latin-*.woff2`, `fraunces-v38-latin-*.woff2`). Preloads are in `src/routes/+layout.svelte`. Do not add Google Fonts or other external font URLs for the main site or error pages. + +## Key paths + +| Path | Role | +|------|------| +| `src/app.css` | Single global stylesheet: CSS variables (light/dark), base styles, components. Source of truth for theme tokens. | +| `src/app.html` | SvelteKit HTML shell. Rarely edited. | +| `src/routes/+layout.svelte` | Root layout: head (meta, fonts, favicon, scripts), skip link, slot. Imports `app.css`. | +| `src/routes/+layout.ts` | Exports `prerender = true`, `ssr = true`, `csr = false`. Do not enable CSR. | +| `src/routes/+page.svelte` | Home page; composes sections from `src/lib/components/`. | +| `src/lib/data/*.ts` | Content and meta (home-meta, content, experience, engagements, json-ld). Edit here for copy or SEO. | +| `src/lib/seo.ts` | SEO defaults (baseUrl, theme colors, etc.) and `mergeMeta()`. | +| `static/` | Copied as-is into `dist/` by SvelteKit. Favicon, robots.txt, fonts, images, **404.html**, **410.html**, and **assets/error-pages.css** live here. | +| `scripts/critters.mjs` | Post-build: inlines critical CSS into **every** `dist/*.html` (including 404 and 410). Resolves stylesheet URLs relative to `dist/`. | +| `scripts/minify-static-js.mjs` | Post-build: minifies JS in `dist/assets/`. | +| `scripts/copy-410-paths.mjs` | Post-build: copies `410.html` to each 410 URL path as `index.html` so static preview (e.g. `serve dist`) shows the 410 page at those URLs; nginx still returns 410 via explicit location blocks. | +| `nginx.conf` | Serves static files; `try_files $uri $uri/ /index.html` for SPA-style fallback; `error_page 404 /404.html` and `error_page 410 /410.html` for custom error pages. | + +## Static error pages (404, 410) + +- **Files**: `static/404.html`, `static/410.html`. They are **standalone HTML** (not Svelte). Do not convert them to Svelte routes. +- **Styling**: Both link to **one** shared stylesheet: ``. All error-page CSS lives in **`static/assets/error-pages.css`** (theme variables for light/dark, local `@font-face` for Inter/Fraunces, layout for `.error-page`). Do not duplicate theme tokens or add inline `