mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-17 03:56:19 +02:00
fix: Switching language error on tabbed pages, add 404 page
This commit is contained in:
parent
a61b299b51
commit
2a9500089c
4 changed files with 35 additions and 12 deletions
|
@ -19,7 +19,7 @@ const marginBottom = {
|
|||
---
|
||||
|
||||
<header class="mb-10.625 lg:fixed">
|
||||
<h1 class={`${marginBottom} text-8 c-primary font-bold font-title lg:text-9 w-75%`}>
|
||||
<h1 class={`${marginBottom} text-8 c-primary font-bold font-title lg:text-9 w-75% lg:w-full`}>
|
||||
<!-- Fix text cropping issues during view transition on ios by adding a div tag -->
|
||||
<div
|
||||
class="box-content inline-block pr-1.25"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
import { getNextLangUrl, getPostNextLangUrl } from '@/i18n/path'
|
||||
import { isPostPage } from '@/utils/page'
|
||||
import { isPostPage, isTagPage } from '@/utils/page'
|
||||
|
||||
interface Props {
|
||||
supportedLangs: string[]
|
||||
|
@ -9,10 +9,15 @@ interface Props {
|
|||
const { supportedLangs } = Astro.props
|
||||
const currentPath = Astro.url.pathname
|
||||
const isPost = isPostPage(currentPath)
|
||||
const isTag = isTagPage(currentPath)
|
||||
|
||||
const nextUrl = isPost
|
||||
? getPostNextLangUrl(currentPath, supportedLangs)
|
||||
: getNextLangUrl(currentPath)
|
||||
// 检查是否应使用受限的语言列表
|
||||
const useFilteredLangs = isPost || (isTag && supportedLangs.length > 0)
|
||||
|
||||
// 根据页面类型选择合适的语言切换方式
|
||||
const nextUrl = useFilteredLangs
|
||||
? getPostNextLangUrl(currentPath, supportedLangs) // 只在有内容的语言间切换
|
||||
: getNextLangUrl(currentPath) // 在所有语言间切换
|
||||
---
|
||||
|
||||
<a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue