webapp/src/pages/topic/[slug].astro

16 lines
525 B
Plaintext
Raw Normal View History

2022-09-09 11:53:35 +00:00
---
2022-09-22 09:37:49 +00:00
import { Root } from '../../components/Root'
2022-09-09 11:53:35 +00:00
import Zine from '../../layouts/zine.astro'
import { apiClient } from '../../utils/apiClient'
const slug = Astro.params.slug?.toString() || ''
2022-09-22 09:37:49 +00:00
const articles = await apiClient.getArticlesForTopics({ topicSlugs: [slug], limit: 50 })
2022-09-09 11:53:35 +00:00
const topic = articles[0].topics.find(({ slug: topicSlug }) => topicSlug === slug)
Astro.response.headers.set('Cache-Control', 's-maxage=1, stale-while-revalidate')
---
<Zine>
2022-09-22 09:37:49 +00:00
<Root articles={articles} topic={topic} client:load />
2022-09-09 11:53:35 +00:00
</Zine>