import { readFile, writeFile, mkdir } from 'node:fs/promises'; import { render } from '../.ssr/render.js'; import { pages, headTags } from './seo.mjs'; const template = await readFile('dist/index.html', 'utf8'); for (const path of Object.keys(pages)) { const html = template.replace('', render(path)) .replace(/.*?<\/title><!--seo-->/, headTags(path)); if (path === '/') await writeFile('dist/index.html', html); else if (path === '/404') await writeFile('dist/404.html', html); else { await writeFile(`dist${path}.html`, html); await mkdir(`dist${path}`, { recursive: true }); await writeFile(`dist${path}/index.html`, html); } } await mkdir('dist/waitlist', { recursive: true }); await writeFile('dist/waitlist/index.html', '<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="refresh" content="0;url=/"><link rel="canonical" href="https://inkspring.ai/"><title>InkspringInkspring has moved to the homepage.'); console.log('Prerendered homepage, download, help, compare, privacy, app notices, 404, and legacy waitlist redirect as static HTML.');