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

22 lines
715 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-11-13 09:25:31 +00:00
import Prerendered from '../../main.astro'
2022-09-09 11:53:35 +00:00
import { apiClient } from '../../utils/apiClient'
import { PRERENDERED_ARTICLES_COUNT } from '../../components/Views/Topic'
2022-09-09 11:53:35 +00:00
const slug = Astro.params.slug?.toString() || ''
2022-11-18 02:23:04 +00:00
const shouts = await apiClient.getShouts({ filters: { topic: slug }, limit: PRERENDERED_ARTICLES_COUNT })
const topic = await apiClient.getTopic({ slug })
2022-09-09 11:53:35 +00:00
2022-09-23 18:27:05 +00:00
import { initRouter } from '../../stores/router'
const { pathname, search } = Astro.url
initRouter(pathname, search)
2022-09-09 11:53:35 +00:00
Astro.response.headers.set('Cache-Control', 's-maxage=1, stale-while-revalidate')
---
2022-11-13 09:25:31 +00:00
<Prerendered>
2022-12-07 19:49:03 +00:00
<Root topicShouts={shouts} topic={topic} client:load />
2022-11-13 09:25:31 +00:00
</Prerendered>