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
+4 -2
View File
@@ -1,7 +1,9 @@
---
const { heading = 'Frequently asked questions', items = [] } = Astro.props;
import { render } from 'astro:content';
const { heading = 'Frequently asked questions', entries = [] } = Astro.props;
const items = await Promise.all(entries.map(async (entry) => ({ ...entry.data, Content: (await render(entry)).Content })));
if (!items.length) return;
---
<section class="section faq-section" aria-labelledby="faq-heading">
<div class="shell narrow"><p class="eyebrow">Helpful answers</p><h2 id="faq-heading">{heading}</h2><div class="faq-list">{items.map((item) => <details><summary>{item.question}</summary><p>{item.answer}</p></details>)}</div></div>
<div class="shell narrow"><p class="eyebrow">Helpful answers</p><h2 id="faq-heading">{heading}</h2><div class="faq-list">{items.map((item) => <details><summary>{item.question}</summary><div class="faq-answer"><item.Content /></div></details>)}</div></div>
</section>