mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-17 20:01:33 +02:00
fix: optimize the language switching order on the article page
This commit is contained in:
parent
355b044e9f
commit
a61b299b51
2 changed files with 20 additions and 5 deletions
|
@ -38,6 +38,14 @@ export async function getStaticPaths() {
|
|||
}
|
||||
})
|
||||
|
||||
// 对每个文章的supportedLangs按照allLocales的顺序排序
|
||||
Object.keys(slugToLangs).forEach((slug) => {
|
||||
// 按照allLocales的顺序排序
|
||||
slugToLangs[slug].sort((a, b) => {
|
||||
return allLocales.indexOf(a) - allLocales.indexOf(b)
|
||||
})
|
||||
})
|
||||
|
||||
// 定义路径数组的类型
|
||||
type PathItem = {
|
||||
params: { posts_slug: string }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue