Add Markdown blog and FAQ content collections
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user