File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,16 +4,25 @@ import BaseLayout from '../../layouts/base.astro'
44import Join from ' ../../components/join.astro'
55import MarkdownContent from ' ../../components/markdown-content.astro'
66import { getCollection , render } from ' astro:content'
7+ import type keystaticConfig from ' ../../../keystatic.config'
8+ import type { Entry } from ' @keystatic/core/reader'
9+
10+ type Replace <T , K extends keyof T , V > = Omit <T , K > & {
11+ [key in K ]: V
12+ }
713
814export async function getStaticPaths() {
915 const projectEntries = await getCollection (' projects' , ({ data }) => {
1016 return import .meta .env .PROD ? data .draft !== true : true
1117 })
1218
13- return projectEntries .map ((entry ) => ({
14- params: { slug: entry .id },
15- props: { entry },
16- }))
19+ return projectEntries .map ((e ) => {
20+ const entry: Replace <typeof e , ' data' , Entry <typeof keystaticConfig [' collections' ][' projects' ]>> = e
21+ return {
22+ params: { slug: entry .id },
23+ props: { entry },
24+ }
25+ })
1726}
1827const { entry } = Astro .props
1928const { Content } = await render (entry )
You can’t perform that action at this time.
0 commit comments