mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-16 11:41:17 +02:00
test: i18n support
This commit is contained in:
parent
d2bda0594d
commit
32ffec8480
8 changed files with 340 additions and 6 deletions
23
src/pages/posts/[slug].astro
Normal file
23
src/pages/posts/[slug].astro
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
import Layout from '@/layouts/Layout.astro'
|
||||
import { getCollection } from 'astro:content'
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const posts = await getCollection('posts')
|
||||
return posts.map(post => ({
|
||||
params: { slug: post.slug },
|
||||
props: { post },
|
||||
}))
|
||||
}
|
||||
|
||||
const { post } = Astro.props
|
||||
const { Content } = await post.render()
|
||||
---
|
||||
|
||||
<Layout>
|
||||
<article>
|
||||
<h1>{post.data.title}</h1>
|
||||
<time>{post.data.published.toISOString().split('T')[0]}</time>
|
||||
<Content />
|
||||
</article>
|
||||
</Layout>
|
Loading…
Add table
Add a link
Reference in a new issue