mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-16 19:51:07 +02:00
feat: enhance internationalization support with dynamic routing
This commit is contained in:
parent
d6c98880d3
commit
8c19d26cfd
12 changed files with 199 additions and 87 deletions
|
@ -1,13 +1,16 @@
|
|||
---
|
||||
import { themeConfig } from '@/config'
|
||||
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 },
|
||||
}))
|
||||
return themeConfig.global.moreLocale.flatMap(lang =>
|
||||
posts.map(post => ({
|
||||
params: { lang, slug: post.slug },
|
||||
props: { post },
|
||||
})),
|
||||
)
|
||||
}
|
||||
|
||||
const { post } = Astro.props
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue