new source of truth
Some checks are pending
/ deploy (push) Waiting to run

This commit is contained in:
Loyyd 2026-06-11 10:01:45 +02:00
parent 9d0a823351
commit d74495ddef
936 changed files with 80 additions and 69 deletions

View file

@ -2,11 +2,13 @@ import fs from "node:fs";
import path from "node:path";
const repoRoot = process.cwd();
const websiteRoot = path.join(repoRoot, "website");
const legacyHtmlRoot = path.join(repoRoot, "archive-source");
const contentRoot = path.join(repoRoot, "content");
const contentReadme = `# Content Archive
const contentReadme = `# Content
These Markdown files were extracted from the exported HTML posts in \`website/\`.
This directory is the future source of truth for editable site content.
These Markdown files were extracted from the exported HTML posts in \`archive-source/\`.
The body content intentionally keeps its original HTML markup so the migration
does not lose formatting, links, headings, or embedded images.
@ -14,7 +16,7 @@ does not lose formatting, links, headings, or embedded images.
- \`content/speeches/mrs-hak-ja-han-moon/\` - Mrs. Hak Ja Han Moon speech posts
- \`content/blog/<year>/\` - non-speech blog posts grouped by published year
Regenerate this archive from \`website/blog/\` with:
Regenerate this content from \`archive-source/blog/\` with:
\`\`\`bash
npm run extract:content
@ -96,7 +98,7 @@ function slugFromPath(filePath) {
}
function relativeUrl(filePath) {
return `/${path.relative(websiteRoot, filePath).split(path.sep).join("/")}`;
return `/${path.relative(legacyHtmlRoot, filePath).split(path.sep).join("/")}`;
}
function destinationFor(post) {
@ -177,7 +179,7 @@ function renderMarkdown(post) {
fs.rmSync(contentRoot, { recursive: true, force: true });
const postFiles = walk(path.join(websiteRoot, "blog")).filter((filePath) => /\/\d{4}\/\d{2}\/\d{2}\//.test(filePath));
const postFiles = walk(path.join(legacyHtmlRoot, "blog")).filter((filePath) => /\/\d{4}\/\d{2}\/\d{2}\//.test(filePath));
const posts = postFiles.map(extractPost).filter(Boolean);
for (const post of posts) {