fix: optimize the language switching order on the article page

This commit is contained in:
radishzzz 2025-03-15 12:36:02 +00:00
parent 355b044e9f
commit a61b299b51
2 changed files with 20 additions and 5 deletions

View file

@ -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 }