From 10e1780dcc023e44f2edffe39618c6dda3473280 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 3 Sep 2026 00:30:11 +0530 Subject: [PATCH] feat(theme): render the not-found page through the layout The default theme exports `NotFound.vue` as its `NotFound` component and renders the not-found page like any page: an authored `404.md` as a doc page without sidebar, aside or edit link unless frontmatter says otherwise, the synthesized one bare. `useLayout()` gains `layout`, the resolved layout name. Pages outside the sidebar no longer get the first sidebar entry as their next link. The home link of the not-found page has no `aria-label` anymore: it differed from the visible text, which fails WCAG 2.5.3. BREAKING CHANGE: the `not-found` layout slot is removed, write a `404.md` instead; `themeConfig.notFound.linkLabel` is removed, the visible `linkText` is the accessible name. Co-Authored-By: Claude Fable 5.1 --- docs/es/config.ts | 1 - docs/fa/config.ts | 1 - docs/ko/config.ts | 1 - docs/pt/config.ts | 1 - docs/ru/config.ts | 1 - docs/zh/config.ts | 1 - src/client/theme-default/Layout.vue | 1 - src/client/theme-default/NotFound.vue | 6 +---- .../theme-default/components/VPContent.vue | 15 ++++------- .../theme-default/components/VPDocFooter.vue | 4 ++- .../theme-default/composables/layout.ts | 21 +++++++++++++--- .../theme-default/composables/prev-next.ts | 25 +++++++++++-------- src/client/theme-default/without-fonts.ts | 2 ++ types/default-theme.d.ts | 13 +++++----- 14 files changed, 49 insertions(+), 44 deletions(-) diff --git a/docs/es/config.ts b/docs/es/config.ts index 43b2dfb7..2cc660cd 100644 --- a/docs/es/config.ts +++ b/docs/es/config.ts @@ -62,7 +62,6 @@ export default defineAdditionalConfig({ title: 'PÁGINA NO ENCONTRADA', quote: 'Pero si no cambias de dirección y sigues buscando, podrías terminar donde te diriges.', - linkLabel: 'ir a inicio', linkText: 'Llévame a inicio' }, diff --git a/docs/fa/config.ts b/docs/fa/config.ts index 2b7dcc1c..3e438c82 100644 --- a/docs/fa/config.ts +++ b/docs/fa/config.ts @@ -70,7 +70,6 @@ export default defineAdditionalConfig({ title: 'صفحه پیدا نشد', quote: 'اما اگر جهت خود را تغییر ندهید و همچنان به جستجو ادامه دهید، ممکن است در نهایت به جایی برسید که در حال رفتن به آن هستید.', - linkLabel: 'برو به خانه', linkText: 'من را به خانه ببر' }, diff --git a/docs/ko/config.ts b/docs/ko/config.ts index 2226254d..2768ca14 100644 --- a/docs/ko/config.ts +++ b/docs/ko/config.ts @@ -62,7 +62,6 @@ export default defineAdditionalConfig({ title: '페이지를 찾을 수 없습니다', quote: '방향을 바꾸지 않고 계속 찾다 보면 결국 당신이 가고 있는 곳에 도달할 수도 있습니다.', - linkLabel: '홈으로 가기', linkText: '집으로 데려가줘' }, diff --git a/docs/pt/config.ts b/docs/pt/config.ts index 9b99bef3..6bf1fbcb 100644 --- a/docs/pt/config.ts +++ b/docs/pt/config.ts @@ -62,7 +62,6 @@ export default defineAdditionalConfig({ title: 'PÁGINA NÃO ENCONTRADA', quote: 'Mas se você não mudar de direção e continuar procurando, pode acabar onde está indo.', - linkLabel: 'ir para a página inicial', linkText: 'Me leve para casa' }, diff --git a/docs/ru/config.ts b/docs/ru/config.ts index 4a4fa3d7..d12ff093 100644 --- a/docs/ru/config.ts +++ b/docs/ru/config.ts @@ -60,7 +60,6 @@ export default defineAdditionalConfig({ title: 'СТРАНИЦА НЕ НАЙДЕНА', quote: 'Но если ты не изменишь направление и продолжишь искать, ты можешь оказаться там, куда направляешься.', - linkLabel: 'перейти на главную', linkText: 'Отведи меня домой' }, diff --git a/docs/zh/config.ts b/docs/zh/config.ts index 41a557a5..fc52c087 100644 --- a/docs/zh/config.ts +++ b/docs/zh/config.ts @@ -62,7 +62,6 @@ export default defineAdditionalConfig({ title: '页面未找到', quote: '但如果你不改变方向,并且继续寻找,你可能最终会到达你所前往的地方。', - linkLabel: '前往首页', linkText: '带我回首页' }, diff --git a/src/client/theme-default/Layout.vue b/src/client/theme-default/Layout.vue index c9a4af67..f0e7ef51 100644 --- a/src/client/theme-default/Layout.vue +++ b/src/client/theme-default/Layout.vue @@ -64,7 +64,6 @@ provide(layoutInfoInjectionKey, { heroImageSlotExists }) - diff --git a/src/client/theme-default/NotFound.vue b/src/client/theme-default/NotFound.vue index 5805ac80..1cf11cbe 100644 --- a/src/client/theme-default/NotFound.vue +++ b/src/client/theme-default/NotFound.vue @@ -21,11 +21,7 @@ const { currentLang } = useLangs()
- + {{ theme.notFound?.linkText ?? 'Take me home' }}
diff --git a/src/client/theme-default/components/VPContent.vue b/src/client/theme-default/components/VPContent.vue index ef58f217..6bfdd845 100644 --- a/src/client/theme-default/components/VPContent.vue +++ b/src/client/theme-default/components/VPContent.vue @@ -1,15 +1,12 @@