Migrate legacy archive pages

This commit is contained in:
Workshop Bot 2026-06-11 18:31:35 +00:00
parent e90920ce86
commit cbedd9b723
25 changed files with 652 additions and 1 deletions

View file

@ -4,16 +4,37 @@ import path from "node:path";
export const repoRoot = process.cwd();
export const legacyHtmlRoot = path.join(repoRoot, "archive-source");
export const migratedHtmlPages = new Set([
"2013-sunday-service-archive.html",
"2014-sunday-services.html",
"2015-sunday-services-archive.html",
"2016-sunday-service-archive.html",
"2017-sunday-service-archive.html",
"2018-sunday-service-archive.html",
"about.html",
"about-us-organizations.html",
"archive-sunday-services-2013.html",
"archive-sunday-services-2014.html",
"archive-sunday-services-2015.html",
"archive-sunday-services-2016.html",
"archive-sunday-services-2017.html",
"archive-sunday-services-2018.html",
"contact.html",
"events.html",
"index.html",
"register.html",
"services.html",
"speeches/index.html",
"the-founders.html",
"videos.html",
]);
const migratedHtmlPrefixes = [
"blog/categories/",
"blog/tags/",
"speeches/categories/",
"speeches/rev-dr-sun-myung-moon/",
];
export function walkHtmlFiles(dir = legacyHtmlRoot): string[] {
return fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
const fullPath = path.join(dir, entry.name);
@ -37,7 +58,7 @@ export function routeFromRelativePath(relativePath: string): string {
}
export function isMigratedHtmlPage(relativePath: string): boolean {
return migratedHtmlPages.has(relativePath);
return migratedHtmlPages.has(relativePath) || migratedHtmlPrefixes.some((prefix) => relativePath.startsWith(prefix));
}
export function sourcePathFromRoute(route = ""): string {