Add Markdown blog and FAQ content collections

This commit is contained in:
Kevin
2026-09-02 10:25:49 -04:00
parent e45bbe4111
commit 78cfe0cc71
20 changed files with 176 additions and 27 deletions
+17
View File
@@ -14,4 +14,21 @@ for (const { file, html } of pages) {
if (!/<title>[^<]+<\/title>/.test(html)) throw new Error(`${file} is missing a title.`);
for (const match of html.matchAll(/(?:src|href)="(\/images\/[^"?#]+)"/g)) await access(resolve(root, `.${match[1]}`));
}
const home = await readFile(resolve(root, 'index.html'), 'utf8');
if (key === 'www') {
if (!home.includes('What services do you offer?') || !home.includes('How do I book a visit?')) throw new Error('Primary FAQ Markdown entries are missing from the homepage.');
if (home.includes('What information should I bring to a meet and greet?')) throw new Error('Draft FAQ entry appeared in the homepage.');
}
if (key === 'blog') {
const publishedPosts = ['first-walk-after-work', 'gentler-grooming-day', 'overnight-care-checklist'];
await Promise.all(publishedPosts.map((slug) => access(resolve(root, `posts/${slug}/index.html`))));
if (home.includes('Draft only example for editorial review')) throw new Error('Draft blog post appeared in the journal.');
try {
await access(resolve(root, 'posts/draft-only-example/index.html'));
throw new Error('Draft blog post generated a public page.');
} catch (error) {
if (error?.code !== 'ENOENT') throw error;
}
}
console.log(`Verified ${key}: ${required.join(', ')}`);