From 927aa89213d59d2a6c6fcfbd3ebcbdf63f0a00e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Berg=C3=A9?= Date: Tue, 5 May 2026 15:12:12 +0200 Subject: [PATCH] Add "Go to home" button on 404 page (#4236) --- .../components/SitePage/SitePageNotFound.tsx | 27 +++++++++++-------- packages/gitbook/src/intl/translations/de.ts | 1 + packages/gitbook/src/intl/translations/en.ts | 1 + packages/gitbook/src/intl/translations/es.ts | 1 + packages/gitbook/src/intl/translations/fr.ts | 1 + packages/gitbook/src/intl/translations/it.ts | 1 + packages/gitbook/src/intl/translations/ja.ts | 1 + packages/gitbook/src/intl/translations/ko.ts | 1 + packages/gitbook/src/intl/translations/nl.ts | 1 + packages/gitbook/src/intl/translations/no.ts | 1 + .../gitbook/src/intl/translations/pt-br.ts | 1 + packages/gitbook/src/intl/translations/ru.ts | 1 + packages/gitbook/src/intl/translations/zh.ts | 1 + 13 files changed, 28 insertions(+), 11 deletions(-) diff --git a/packages/gitbook/src/components/SitePage/SitePageNotFound.tsx b/packages/gitbook/src/components/SitePage/SitePageNotFound.tsx index 7a298f369..b1f49f34f 100644 --- a/packages/gitbook/src/components/SitePage/SitePageNotFound.tsx +++ b/packages/gitbook/src/components/SitePage/SitePageNotFound.tsx @@ -10,7 +10,7 @@ import { PreservePageLayout } from '../PageBody/PreservePageLayout'; import { SiteAuthLoginButton } from '../SiteAuth/SiteAuthLoginLink'; import { useSiteAdaptiveAuthLoginHref, useSpaceBasePath } from '../SpaceLayout/SpaceLayoutContext'; import { CurrentPageProvider } from '../hooks'; -import { SuspenseLoadedHint } from '../primitives'; +import { Button, SuspenseLoadedHint } from '../primitives'; /** * Component that displays a "page not found" message. @@ -63,16 +63,21 @@ export function SitePageNotFound() {

{t(language, adaptiveAuthLoginHref ? 'notfound_adaptive' : 'notfound')}

- {adaptiveAuthLoginHref ? ( - - {t(language, 'notfound_adaptive_login')} - - ) : null} +
+ {adaptiveAuthLoginHref ? ( + + {t(language, 'notfound_adaptive_login')} + + ) : null} + +
diff --git a/packages/gitbook/src/intl/translations/de.ts b/packages/gitbook/src/intl/translations/de.ts index 3907a2971..42bb8923d 100644 --- a/packages/gitbook/src/intl/translations/de.ts +++ b/packages/gitbook/src/intl/translations/de.ts @@ -75,6 +75,7 @@ export const de = { notfound_adaptive: 'Diese Seite existiert möglicherweise, aber Sie müssen sich eventuell anmelden, um darauf zuzugreifen.', notfound_adaptive_login: 'Anmelden', + notfound_goto_home: 'Zur Startseite', unexpected_error_title: 'Ein Fehler ist aufgetreten', unexpected_error: 'Entschuldigung, ein unerwarteter Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.', diff --git a/packages/gitbook/src/intl/translations/en.ts b/packages/gitbook/src/intl/translations/en.ts index 34cbc48c2..cbed5b28d 100644 --- a/packages/gitbook/src/intl/translations/en.ts +++ b/packages/gitbook/src/intl/translations/en.ts @@ -72,6 +72,7 @@ export const en = { notfound_adaptive_title: 'Page unavailable', notfound_adaptive: 'This page may exist, but you may need to log in to access it.', notfound_adaptive_login: 'Log in', + notfound_goto_home: 'Go to homepage', unexpected_error_title: 'An error occurred', unexpected_error: 'Sorry, an unexpected error has occurred. Please try again later.', unexpected_error_retry: 'Try again', diff --git a/packages/gitbook/src/intl/translations/es.ts b/packages/gitbook/src/intl/translations/es.ts index 24c0680b0..06d2f622c 100644 --- a/packages/gitbook/src/intl/translations/es.ts +++ b/packages/gitbook/src/intl/translations/es.ts @@ -76,6 +76,7 @@ export const es: TranslationLanguage = { notfound_adaptive: 'Esta página puede existir, pero es posible que debas iniciar sesión para acceder.', notfound_adaptive_login: 'Iniciar sesión', + notfound_goto_home: 'Ir al inicio', unexpected_error_title: 'Ocurrió un error', unexpected_error: 'Lo sentimos, ha ocurrido un error inesperado. Por favor, intenta de nuevo más tarde.', diff --git a/packages/gitbook/src/intl/translations/fr.ts b/packages/gitbook/src/intl/translations/fr.ts index 161611fc6..5d63c1370 100644 --- a/packages/gitbook/src/intl/translations/fr.ts +++ b/packages/gitbook/src/intl/translations/fr.ts @@ -73,6 +73,7 @@ export const fr = { notfound_adaptive: 'Cette page existe peut-être, mais vous devez peut-être vous connecter pour y accéder.', notfound_adaptive_login: 'Se connecter', + notfound_goto_home: "Aller à l'accueil", unexpected_error_title: 'Erreur inattendue', unexpected_error: 'Désolé, une erreur est survenue. Veuillez réessayer plus tard.', unexpected_error_retry: 'Réessayer', diff --git a/packages/gitbook/src/intl/translations/it.ts b/packages/gitbook/src/intl/translations/it.ts index cbbe2ad0c..6d7508e84 100644 --- a/packages/gitbook/src/intl/translations/it.ts +++ b/packages/gitbook/src/intl/translations/it.ts @@ -76,6 +76,7 @@ export const it: TranslationLanguage = { notfound_adaptive: "Questa pagina potrebbe esistere, ma potrebbe essere necessario effettuare l'accesso per visualizzarla.", notfound_adaptive_login: 'Accedi', + notfound_goto_home: 'Vai alla home', unexpected_error_title: 'Si è verificato un errore', unexpected_error: 'Spiacenti, si è verificato un errore imprevisto. Riprova più tardi.', unexpected_error_retry: 'Riprova', diff --git a/packages/gitbook/src/intl/translations/ja.ts b/packages/gitbook/src/intl/translations/ja.ts index 5acb0d311..55e4c0d50 100644 --- a/packages/gitbook/src/intl/translations/ja.ts +++ b/packages/gitbook/src/intl/translations/ja.ts @@ -76,6 +76,7 @@ export const ja: TranslationLanguage = { notfound_adaptive: 'このページは存在する可能性がありますが、アクセスするにはログインが必要な場合があります。', notfound_adaptive_login: 'ログイン', + notfound_goto_home: 'ホームへ移動', unexpected_error_title: 'エラーが発生しました', unexpected_error: '申し訳ありません、予期せぬエラーが発生しました。もう一度お試しください。', unexpected_error_retry: '再試行', diff --git a/packages/gitbook/src/intl/translations/ko.ts b/packages/gitbook/src/intl/translations/ko.ts index 6fe819c51..7d33e7abe 100644 --- a/packages/gitbook/src/intl/translations/ko.ts +++ b/packages/gitbook/src/intl/translations/ko.ts @@ -75,6 +75,7 @@ export const ko: TranslationLanguage = { notfound_adaptive_title: '페이지에 접근할 수 없음', notfound_adaptive: '이 페이지는 존재할 수 있지만, 접근하려면 로그인해야 할 수 있습니다.', notfound_adaptive_login: '로그인', + notfound_goto_home: '홈으로 이동', unexpected_error_title: '오류가 발생했습니다', unexpected_error: '죄송합니다. 예상치 못한 오류가 발생했습니다. 나중에 다시 시도해 주세요.', unexpected_error_retry: '다시 시도', diff --git a/packages/gitbook/src/intl/translations/nl.ts b/packages/gitbook/src/intl/translations/nl.ts index 6b39688d4..5b6c160ec 100644 --- a/packages/gitbook/src/intl/translations/nl.ts +++ b/packages/gitbook/src/intl/translations/nl.ts @@ -76,6 +76,7 @@ export const nl: TranslationLanguage = { notfound_adaptive: 'Deze pagina bestaat mogelijk, maar je moet mogelijk inloggen om toegang te krijgen.', notfound_adaptive_login: 'Inloggen', + notfound_goto_home: 'Ga naar home', unexpected_error_title: 'Er is een fout opgetreden', unexpected_error: 'Sorry, er is een onverwachte fout opgetreden. Probeer het later opnieuw.', unexpected_error_retry: 'Opnieuw proberen', diff --git a/packages/gitbook/src/intl/translations/no.ts b/packages/gitbook/src/intl/translations/no.ts index 72eaf2f29..5689955d9 100644 --- a/packages/gitbook/src/intl/translations/no.ts +++ b/packages/gitbook/src/intl/translations/no.ts @@ -76,6 +76,7 @@ export const no: TranslationLanguage = { notfound_adaptive_title: 'Siden er ikke tilgjengelig', notfound_adaptive: 'Denne siden kan finnes, men du må kanskje logge inn for å få tilgang.', notfound_adaptive_login: 'Logg inn', + notfound_goto_home: 'Gå til forsiden', unexpected_error_title: 'En feil oppstod', unexpected_error: 'Beklager, en uventet feil har oppstått. Vennligst prøv igjen senere.', unexpected_error_retry: 'Prøv igjen', diff --git a/packages/gitbook/src/intl/translations/pt-br.ts b/packages/gitbook/src/intl/translations/pt-br.ts index a328f0029..1eebd2517 100644 --- a/packages/gitbook/src/intl/translations/pt-br.ts +++ b/packages/gitbook/src/intl/translations/pt-br.ts @@ -74,6 +74,7 @@ export const pt_br = { notfound_adaptive: 'Esta página pode existir, mas talvez você precise fazer login para acessá-la.', notfound_adaptive_login: 'Fazer login', + notfound_goto_home: 'Ir para a página inicial', unexpected_error_title: 'Aconteceu um erro', unexpected_error: 'Desculpe, aconteceu um erro inesperado. Por favor, tente novamente mais tarde.', diff --git a/packages/gitbook/src/intl/translations/ru.ts b/packages/gitbook/src/intl/translations/ru.ts index ad5b4ab84..db3a2601a 100644 --- a/packages/gitbook/src/intl/translations/ru.ts +++ b/packages/gitbook/src/intl/translations/ru.ts @@ -74,6 +74,7 @@ export const ru = { notfound_adaptive: 'Эта страница может существовать, но для доступа к ней может потребоваться вход.', notfound_adaptive_login: 'Войти', + notfound_goto_home: 'Перейти на главную', unexpected_error_title: 'Произошла ошибка', unexpected_error: 'Извините, произошла непредвиденная ошибка. Пожалуйста, попробуйте позже.', unexpected_error_retry: 'Попробуйте снова', diff --git a/packages/gitbook/src/intl/translations/zh.ts b/packages/gitbook/src/intl/translations/zh.ts index db14f74f7..b0f7ae9d7 100644 --- a/packages/gitbook/src/intl/translations/zh.ts +++ b/packages/gitbook/src/intl/translations/zh.ts @@ -73,6 +73,7 @@ export const zh: TranslationLanguage = { notfound_adaptive_title: '页面无法访问', notfound_adaptive: '该页面可能存在,但您可能需要登录后才能访问。', notfound_adaptive_login: '登录', + notfound_goto_home: '前往首页', unexpected_error_title: '发生错误', unexpected_error: '抱歉,发生了意外的错误。请稍后再试。', unexpected_error_retry: '重试',