mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-15 19:22:52 +02:00
chore: update detail
This commit is contained in:
parent
91d27dd2ba
commit
ca1abd28c1
10 changed files with 63 additions and 61 deletions
|
@ -34,7 +34,7 @@
|
||||||
"rehype-components": "^0.3.0",
|
"rehype-components": "^0.3.0",
|
||||||
"rehype-external-links": "^3.0.0",
|
"rehype-external-links": "^3.0.0",
|
||||||
"rehype-katex": "^7.0.1",
|
"rehype-katex": "^7.0.1",
|
||||||
"rehype-pretty-code": "^0.14.0",
|
"rehype-pretty-code": "^0.14.1",
|
||||||
"rehype-slug": "^6.0.0",
|
"rehype-slug": "^6.0.0",
|
||||||
"remark-directive": "^4.0.0",
|
"remark-directive": "^4.0.0",
|
||||||
"remark-github-admonitions-to-directives": "^2.1.0",
|
"remark-github-admonitions-to-directives": "^2.1.0",
|
||||||
|
|
46
pnpm-lock.yaml
generated
46
pnpm-lock.yaml
generated
|
@ -66,8 +66,8 @@ importers:
|
||||||
specifier: ^7.0.1
|
specifier: ^7.0.1
|
||||||
version: 7.0.1
|
version: 7.0.1
|
||||||
rehype-pretty-code:
|
rehype-pretty-code:
|
||||||
specifier: ^0.14.0
|
specifier: ^0.14.1
|
||||||
version: 0.14.0(shiki@1.29.2)
|
version: 0.14.1(shiki@1.29.2)
|
||||||
rehype-slug:
|
rehype-slug:
|
||||||
specifier: ^6.0.0
|
specifier: ^6.0.0
|
||||||
version: 6.0.0
|
version: 6.0.0
|
||||||
|
@ -143,7 +143,7 @@ importers:
|
||||||
version: 1.5.0
|
version: 1.5.0
|
||||||
unocss:
|
unocss:
|
||||||
specifier: 66.1.0-beta.5
|
specifier: 66.1.0-beta.5
|
||||||
version: 66.1.0-beta.5(postcss@8.5.3)(vite@6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.8.2))
|
version: 66.1.0-beta.5(postcss@8.5.3)(vite@6.2.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.8.2))
|
||||||
unocss-preset-theme:
|
unocss-preset-theme:
|
||||||
specifier: ^0.14.1
|
specifier: ^0.14.1
|
||||||
version: 0.14.1(@unocss/core@66.1.0-beta.5)
|
version: 0.14.1(@unocss/core@66.1.0-beta.5)
|
||||||
|
@ -2967,11 +2967,11 @@ packages:
|
||||||
rehype-parse@9.0.1:
|
rehype-parse@9.0.1:
|
||||||
resolution: {integrity: sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag==}
|
resolution: {integrity: sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag==}
|
||||||
|
|
||||||
rehype-pretty-code@0.14.0:
|
rehype-pretty-code@0.14.1:
|
||||||
resolution: {integrity: sha512-hBeKF/Wkkf3zyUS8lal9RCUuhypDWLQc+h9UrP9Pav25FUm/AQAVh4m5gdvJxh4Oz+U+xKvdsV01p1LdvsZTiQ==}
|
resolution: {integrity: sha512-IpG4OL0iYlbx78muVldsK86hdfNoht0z63AP7sekQNW2QOTmjxB7RbTO+rhIYNGRljgHxgVZoPwUl6bIC9SbjA==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
shiki: ^1.3.0
|
shiki: ^1.0.0 || ^2.0.0 || ^3.0.0
|
||||||
|
|
||||||
rehype-raw@7.0.0:
|
rehype-raw@7.0.0:
|
||||||
resolution: {integrity: sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww==}
|
resolution: {integrity: sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww==}
|
||||||
|
@ -3496,8 +3496,8 @@ packages:
|
||||||
vfile@6.0.3:
|
vfile@6.0.3:
|
||||||
resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==}
|
resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==}
|
||||||
|
|
||||||
vite@6.2.1:
|
vite@6.2.2:
|
||||||
resolution: {integrity: sha512-n2GnqDb6XPhlt9B8olZPrgMD/es/Nd1RdChF6CBD/fHW6pUyUTt2sQW2fPRX5GiD9XEa6+8A6A4f2vT6pSsE7Q==}
|
resolution: {integrity: sha512-yW7PeMM+LkDzc7CgJuRLMW2Jz0FxMOsVJ8Lv3gpgW9WLcb9cTW+121UEr1hvmfR7w3SegR5ItvYyzVz1vxNJgQ==}
|
||||||
engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
|
engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
@ -4634,13 +4634,13 @@ snapshots:
|
||||||
|
|
||||||
'@ungap/structured-clone@1.3.0': {}
|
'@ungap/structured-clone@1.3.0': {}
|
||||||
|
|
||||||
'@unocss/astro@66.1.0-beta.5(vite@6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.8.2))':
|
'@unocss/astro@66.1.0-beta.5(vite@6.2.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.8.2))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@unocss/core': 66.1.0-beta.5
|
'@unocss/core': 66.1.0-beta.5
|
||||||
'@unocss/reset': 66.1.0-beta.5
|
'@unocss/reset': 66.1.0-beta.5
|
||||||
'@unocss/vite': 66.1.0-beta.5(vite@6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.8.2))
|
'@unocss/vite': 66.1.0-beta.5(vite@6.2.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.8.2))
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
vite: 6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)
|
vite: 6.2.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- vue
|
- vue
|
||||||
|
|
||||||
|
@ -4791,7 +4791,7 @@ snapshots:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@unocss/core': 66.1.0-beta.5
|
'@unocss/core': 66.1.0-beta.5
|
||||||
|
|
||||||
'@unocss/vite@66.1.0-beta.5(vite@6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.8.2))':
|
'@unocss/vite@66.1.0-beta.5(vite@6.2.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.8.2))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@ampproject/remapping': 2.3.0
|
'@ampproject/remapping': 2.3.0
|
||||||
'@unocss/config': 66.1.0-beta.5
|
'@unocss/config': 66.1.0-beta.5
|
||||||
|
@ -4801,7 +4801,7 @@ snapshots:
|
||||||
magic-string: 0.30.17
|
magic-string: 0.30.17
|
||||||
tinyglobby: 0.2.12
|
tinyglobby: 0.2.12
|
||||||
unplugin-utils: 0.2.4
|
unplugin-utils: 0.2.4
|
||||||
vite: 6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)
|
vite: 6.2.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- vue
|
- vue
|
||||||
|
|
||||||
|
@ -5131,8 +5131,8 @@ snapshots:
|
||||||
unist-util-visit: 5.0.0
|
unist-util-visit: 5.0.0
|
||||||
unstorage: 1.15.0
|
unstorage: 1.15.0
|
||||||
vfile: 6.0.3
|
vfile: 6.0.3
|
||||||
vite: 6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)
|
vite: 6.2.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)
|
||||||
vitefu: 1.0.6(vite@6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))
|
vitefu: 1.0.6(vite@6.2.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))
|
||||||
xxhash-wasm: 1.1.0
|
xxhash-wasm: 1.1.0
|
||||||
yargs-parser: 21.1.1
|
yargs-parser: 21.1.1
|
||||||
yocto-spinner: 0.2.1
|
yocto-spinner: 0.2.1
|
||||||
|
@ -7342,7 +7342,7 @@ snapshots:
|
||||||
hast-util-from-html: 2.0.3
|
hast-util-from-html: 2.0.3
|
||||||
unified: 11.0.5
|
unified: 11.0.5
|
||||||
|
|
||||||
rehype-pretty-code@0.14.0(shiki@1.29.2):
|
rehype-pretty-code@0.14.1(shiki@1.29.2):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/hast': 3.0.4
|
'@types/hast': 3.0.4
|
||||||
hast-util-to-string: 3.0.1
|
hast-util-to-string: 3.0.1
|
||||||
|
@ -7907,9 +7907,9 @@ snapshots:
|
||||||
'@unocss/core': 66.1.0-beta.5
|
'@unocss/core': 66.1.0-beta.5
|
||||||
'@unocss/rule-utils': 0.63.6
|
'@unocss/rule-utils': 0.63.6
|
||||||
|
|
||||||
unocss@66.1.0-beta.5(postcss@8.5.3)(vite@6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.8.2)):
|
unocss@66.1.0-beta.5(postcss@8.5.3)(vite@6.2.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.8.2)):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@unocss/astro': 66.1.0-beta.5(vite@6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.8.2))
|
'@unocss/astro': 66.1.0-beta.5(vite@6.2.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.8.2))
|
||||||
'@unocss/cli': 66.1.0-beta.5
|
'@unocss/cli': 66.1.0-beta.5
|
||||||
'@unocss/core': 66.1.0-beta.5
|
'@unocss/core': 66.1.0-beta.5
|
||||||
'@unocss/postcss': 66.1.0-beta.5(postcss@8.5.3)
|
'@unocss/postcss': 66.1.0-beta.5(postcss@8.5.3)
|
||||||
|
@ -7927,9 +7927,9 @@ snapshots:
|
||||||
'@unocss/transformer-compile-class': 66.1.0-beta.5
|
'@unocss/transformer-compile-class': 66.1.0-beta.5
|
||||||
'@unocss/transformer-directives': 66.1.0-beta.5
|
'@unocss/transformer-directives': 66.1.0-beta.5
|
||||||
'@unocss/transformer-variant-group': 66.1.0-beta.5
|
'@unocss/transformer-variant-group': 66.1.0-beta.5
|
||||||
'@unocss/vite': 66.1.0-beta.5(vite@6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.8.2))
|
'@unocss/vite': 66.1.0-beta.5(vite@6.2.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.8.2))
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
vite: 6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)
|
vite: 6.2.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- postcss
|
- postcss
|
||||||
- supports-color
|
- supports-color
|
||||||
|
@ -7987,7 +7987,7 @@ snapshots:
|
||||||
'@types/unist': 3.0.3
|
'@types/unist': 3.0.3
|
||||||
vfile-message: 4.0.2
|
vfile-message: 4.0.2
|
||||||
|
|
||||||
vite@6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0):
|
vite@6.2.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0):
|
||||||
dependencies:
|
dependencies:
|
||||||
esbuild: 0.25.1
|
esbuild: 0.25.1
|
||||||
postcss: 8.5.3
|
postcss: 8.5.3
|
||||||
|
@ -8000,9 +8000,9 @@ snapshots:
|
||||||
terser: 5.37.0
|
terser: 5.37.0
|
||||||
yaml: 2.7.0
|
yaml: 2.7.0
|
||||||
|
|
||||||
vitefu@1.0.6(vite@6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)):
|
vitefu@1.0.6(vite@6.2.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)):
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
vite: 6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)
|
vite: 6.2.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)
|
||||||
|
|
||||||
volar-service-css@0.0.62(@volar/language-service@2.4.12):
|
volar-service-css@0.0.62(@volar/language-service@2.4.12):
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
|
@ -1,7 +1,15 @@
|
||||||
---
|
---
|
||||||
import { themeConfig } from '@/config'
|
import { themeConfig } from '@/config'
|
||||||
import { getWalineLang } from '@/i18n/lang'
|
import { defaultLocale } from '@/i18n/config'
|
||||||
|
import { walineLocaleMap } from '@/i18n/ui'
|
||||||
|
|
||||||
|
// Theme color configuration
|
||||||
|
const {
|
||||||
|
light: { primary: lightPrimary, secondary: lightSecondary, background: lightBackground },
|
||||||
|
dark: { primary: darkPrimary, secondary: darkSecondary, background: darkBackground },
|
||||||
|
} = themeConfig.color
|
||||||
|
|
||||||
|
// Waline configuration
|
||||||
const {
|
const {
|
||||||
serverURL = '',
|
serverURL = '',
|
||||||
emoji = [],
|
emoji = [],
|
||||||
|
@ -9,10 +17,22 @@ const {
|
||||||
imageUploader = false,
|
imageUploader = false,
|
||||||
} = themeConfig.comment?.waline ?? {}
|
} = themeConfig.comment?.waline ?? {}
|
||||||
|
|
||||||
|
// Get current path
|
||||||
const currentPath = Astro.url.pathname
|
const currentPath = Astro.url.pathname
|
||||||
const defaultLocale = themeConfig.global.locale
|
|
||||||
const walineLang = getWalineLang(currentPath, defaultLocale)
|
|
||||||
|
|
||||||
|
// Get the language code of Waline
|
||||||
|
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]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get Waline language and generate configuration
|
||||||
|
const walineLang = getWalineLang(currentPath, defaultLocale)
|
||||||
const walineConfigJson = JSON.stringify({
|
const walineConfigJson = JSON.stringify({
|
||||||
serverURL,
|
serverURL,
|
||||||
lang: walineLang,
|
lang: walineLang,
|
||||||
|
@ -20,12 +40,8 @@ const walineConfigJson = JSON.stringify({
|
||||||
search,
|
search,
|
||||||
imageUploader,
|
imageUploader,
|
||||||
})
|
})
|
||||||
|
|
||||||
const {
|
|
||||||
light: { primary: lightPrimary, secondary: lightSecondary, background: lightBackground },
|
|
||||||
dark: { primary: darkPrimary, secondary: darkSecondary, background: darkBackground },
|
|
||||||
} = themeConfig.color
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<div
|
<div
|
||||||
id="waline"
|
id="waline"
|
||||||
class="mt-16"
|
class="mt-16"
|
||||||
|
@ -33,6 +49,7 @@ const {
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
|
||||||
<!-- Not use is:inline or define:vars -->
|
<!-- Not use is:inline or define:vars -->
|
||||||
<script>
|
<script>
|
||||||
import { init } from '@waline/client'
|
import { init } from '@waline/client'
|
||||||
|
@ -59,6 +76,7 @@ initWaline()
|
||||||
document.addEventListener('astro:after-swap', initWaline)
|
document.addEventListener('astro:after-swap', initWaline)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!-- Custom css styles >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
|
||||||
<style is:global>
|
<style is:global>
|
||||||
#waline .wl-login-info {
|
#waline .wl-login-info {
|
||||||
--at-apply: 'mt-0 mr-3'
|
--at-apply: 'mt-0 mr-3'
|
||||||
|
@ -164,6 +182,8 @@ document.addEventListener('astro:after-swap', initWaline)
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<!-- Official css variables >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
|
||||||
|
<!-- Docs: https://waline.js.org/reference/client/style.html -->
|
||||||
<style
|
<style
|
||||||
define:vars={{
|
define:vars={{
|
||||||
lightPrimary,
|
lightPrimary,
|
||||||
|
|
|
@ -5,7 +5,7 @@ import themeConfig from '@/config'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
class?: string
|
class?: string
|
||||||
supportedLangs?: string[] // 文章支持的语言列表
|
supportedLangs: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const { class: className, supportedLangs = [] } = Astro.props
|
const { class: className, supportedLangs = [] } = Astro.props
|
||||||
|
|
|
@ -3,15 +3,14 @@ import { getNextLangUrl, getPostNextLangUrl } from '@/i18n/lang'
|
||||||
import { isPostPage } from '@/i18n/path'
|
import { isPostPage } from '@/i18n/path'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
supportedLangs?: string[] // 文章支持的语言列表
|
supportedLangs: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const { supportedLangs = [] } = Astro.props
|
const { supportedLangs } = Astro.props
|
||||||
const currentPath = Astro.url.pathname
|
const currentPath = Astro.url.pathname
|
||||||
const isPost = isPostPage(currentPath)
|
const isPost = isPostPage(currentPath)
|
||||||
|
|
||||||
// 根据页面类型选择不同的URL获取函数
|
const nextUrl = isPost
|
||||||
const nextUrl = isPost && supportedLangs.length > 0
|
|
||||||
? getPostNextLangUrl(currentPath, supportedLangs)
|
? getPostNextLangUrl(currentPath, supportedLangs)
|
||||||
: getNextLangUrl(currentPath)
|
: getNextLangUrl(currentPath)
|
||||||
---
|
---
|
||||||
|
@ -26,7 +25,8 @@ const nextUrl = isPost && supportedLangs.length > 0
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
class="h-full w-full"
|
class="h-full w-full"
|
||||||
|
fill="currentColor"
|
||||||
>
|
>
|
||||||
<path d="M19 21 12.3 2h-1L4.7 21l-2.5.2v.8h6.3v-.8L5.7 21l2-5.9h7.5l2 5.9-3.3.2v.8h7.9v-.8zM8 14.3l3.4-10.1 3.5 10.1z" fill="currentColor" />
|
<path d="M19 21 12.3 2h-1L4.7 21l-2.5.2v.8h6.3v-.8L5.7 21l2-5.9h7.5l2 5.9-3.3.2v.8h7.9v-.8zM8 14.3l3.4-10.1 3.5 10.1z" />
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
<button
|
<button
|
||||||
id="theme-toggle"
|
id="theme-toggle"
|
||||||
aria-label="Theme Toggle Button"
|
aria-label="Switch light/dark theme"
|
||||||
class="id-theme-toggle w-4.2 uno-button"
|
class="button-theme-toggle w-4.2 uno-button"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
|
aria-hidden="true"
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
>
|
>
|
||||||
<path d="m12 1c-6.1 0-11 4.9-11 11s4.9 11 11 11 11-4.9 11-11-4.9-11-11-11m0 20c-5.8 0-10.5-4-10.5-9s4.7-9 10.5-9 10.5 4 10.5 9-4.7 9-10.5 9" />
|
<path d="m12 1c-6.1 0-11 4.9-11 11s4.9 11 11 11 11-4.9 11-11-4.9-11-11-11m0 20c-5.8 0-10.5-4-10.5-9s4.7-9 10.5-9 10.5 4 10.5 9-4.7 9-10.5 9" />
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
title: 罗生门
|
title: 罗生门
|
||||||
published: 1971-03-05
|
published: 1915-11-05
|
||||||
tags: ["芥川龙之介","近代文学"]
|
tags: ["芥川龙之介","近代文学"]
|
||||||
lang: zh
|
lang: zh
|
||||||
abbrlink: rashomon
|
abbrlink: rashomon
|
||||||
|
|
|
@ -154,19 +154,3 @@ export function getPostNextLangUrl(currentPath: string, supportedLangs: string[]
|
||||||
// 构建下一个语言的URL
|
// 构建下一个语言的URL
|
||||||
return buildNextLangUrl(currentPath, currentLang, nextLang)
|
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)
|
const clean = cleanPath(path)
|
||||||
return clean === '' || moreLocales.includes(clean)
|
return clean === '' || moreLocales.includes(clean)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isPostPage(path: string) {
|
export function isPostPage(path: string) {
|
||||||
const clean = cleanPath(path)
|
const clean = cleanPath(path)
|
||||||
return clean.startsWith('posts') || moreLocales.some(lang => clean.startsWith(`${lang}/posts`))
|
return clean.startsWith('posts') || moreLocales.some(lang => clean.startsWith(`${lang}/posts`))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isTagPage(path: string) {
|
export function isTagPage(path: string) {
|
||||||
const clean = cleanPath(path)
|
const clean = cleanPath(path)
|
||||||
return clean.startsWith('tags') || moreLocales.some(lang => clean.startsWith(`${lang}/tags`))
|
return clean.startsWith('tags') || moreLocales.some(lang => clean.startsWith(`${lang}/tags`))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isAboutPage(path: string) {
|
export function isAboutPage(path: string) {
|
||||||
const clean = cleanPath(path)
|
const clean = cleanPath(path)
|
||||||
return clean.startsWith('about') || moreLocales.some(lang => clean.startsWith(`${lang}/about`))
|
return clean.startsWith('about') || moreLocales.some(lang => clean.startsWith(`${lang}/about`))
|
||||||
|
|
|
@ -104,7 +104,7 @@ const footerMarginClass = isPost && themeConfig.comment?.waline?.serverURL
|
||||||
// Bind click event to the button
|
// Bind click event to the button
|
||||||
function setupThemeToggle() {
|
function setupThemeToggle() {
|
||||||
// Locate theme toggle button
|
// Locate theme toggle button
|
||||||
const themeToggleButtons = document.querySelectorAll('.id-theme-toggle')
|
const themeToggleButtons = document.querySelectorAll('.button-theme-toggle')
|
||||||
|
|
||||||
// Add click listener to each button
|
// Add click listener to each button
|
||||||
themeToggleButtons.forEach((button) => {
|
themeToggleButtons.forEach((button) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue