mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-16 19:51:07 +02:00
chore: update detail
This commit is contained in:
parent
91d27dd2ba
commit
ca1abd28c1
10 changed files with 63 additions and 61 deletions
|
@ -154,19 +154,3 @@ export function getPostNextLangUrl(currentPath: string, supportedLangs: string[]
|
|||
// 构建下一个语言的URL
|
||||
return buildNextLangUrl(currentPath, currentLang, nextLang)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the language code of Waline
|
||||
* @param currentPath Current page path
|
||||
* @param defaultLocale Default language
|
||||
* @returns Corresponding Waline language code
|
||||
*/
|
||||
export function getWalineLang(currentPath: string, defaultLocale: string): string {
|
||||
// Extract language code from path
|
||||
const pathLang = Object.keys(walineLocaleMap).find(code =>
|
||||
currentPath.startsWith(`/${code}/`),
|
||||
)
|
||||
// Return found path language or default language
|
||||
const lang = pathLang || defaultLocale
|
||||
return walineLocaleMap[lang as keyof typeof walineLocaleMap]
|
||||
}
|
||||
|
|
|
@ -27,17 +27,14 @@ export function isHomePage(path: string) {
|
|||
const clean = cleanPath(path)
|
||||
return clean === '' || moreLocales.includes(clean)
|
||||
}
|
||||
|
||||
export function isPostPage(path: string) {
|
||||
const clean = cleanPath(path)
|
||||
return clean.startsWith('posts') || moreLocales.some(lang => clean.startsWith(`${lang}/posts`))
|
||||
}
|
||||
|
||||
export function isTagPage(path: string) {
|
||||
const clean = cleanPath(path)
|
||||
return clean.startsWith('tags') || moreLocales.some(lang => clean.startsWith(`${lang}/tags`))
|
||||
}
|
||||
|
||||
export function isAboutPage(path: string) {
|
||||
const clean = cleanPath(path)
|
||||
return clean.startsWith('about') || moreLocales.some(lang => clean.startsWith(`${lang}/about`))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue