generate-seo-pages.js produces a static, crawler-friendly companion
site that mirrors the interactive labs and essays.
Unlike the main site (which renders Markdown in the browser with
marked.js), these pages render every README to HTML at build time,
so search engines see fully-formed content with no JavaScript required.
For each lab / experiment / essay (from experiments.json,
essays.json, falling back to labs.json):
companion/<slug>/index.html— README-based landing page with full<head>SEO metadata (title, description, canonical, OpenGraph, Twitter cards) andTechArticle/Article+BreadcrumbListJSON-LD structured data.companion/<slug>/video.html— a dedicated video landing page withVideoObjectstructured data (only when the item declares avideo).
Plus:
companion/index.html— a hub linking to every generated page.companion/sitemap.xml— a sitemap of all generated URLs.
npm install # installs marked (build-time only)
npm run build:seo # writes to ./companionOptions:
node scripts/generate-seo-pages.js \
--out companion \
--base https://math.cognotik.com \
--site-name "Mathematical Explorations" \
--author "SimiaCryptus"| Flag | Default | Description |
|---|---|---|
--out |
companion |
Output folder (relative to root) |
--base |
https://math.cognotik.com |
Canonical base URL |
--root |
process.cwd() |
Project root |
--site-name |
Mathematical Explorations |
Used in titles / OG / JSON-LD |
--author |
SimiaCryptus |
author meta + JSON-LD author |
- Relative image / link URLs inside READMEs are rewritten so they still resolve from each generated page back to the lab's source folder.
mermaidcode blocks are preserved and rendered client-side via a CDN module, loaded only on pages that contain a diagram.- The generated pages have no runtime build dependencies — just HTML, inline CSS, and (optionally) MathJax/Mermaid from CDNs.
- To enable LaTeX rendering on companion pages, you can add MathJax to
extraHeadthe same way Mermaid is handled.