feat(i18n): homepage link for 404 pages (#1117)

* Add homepage link with internationalization

* Construct pathname from baseUrl config value

* More robust URL manipulation

* Add Farsi (#1133)

* Fix bad rebase
This commit is contained in:
James Bennion-Pedley 2024-05-22 21:44:54 +01:00 committed by GitHub
parent 81a4e20236
commit 9c726efa33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 24 additions and 0 deletions

View File

@ -2,10 +2,15 @@ import { i18n } from "../../i18n"
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../types" import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../types"
const NotFound: QuartzComponent = ({ cfg }: QuartzComponentProps) => { const NotFound: QuartzComponent = ({ cfg }: QuartzComponentProps) => {
// If baseUrl contains a pathname after the domain, use this as the home link
const url = new URL(`https://${cfg.baseUrl ?? "example.com"}`)
const baseDir = url.pathname
return ( return (
<article class="popover-hint"> <article class="popover-hint">
<h1>404</h1> <h1>404</h1>
<p>{i18n(cfg.locale).pages.error.notFound}</p> <p>{i18n(cfg.locale).pages.error.notFound}</p>
<a href={baseDir}>{i18n(cfg.locale).pages.error.home}</a>
</article> </article>
) )
} }

View File

@ -70,6 +70,7 @@ export default {
error: { error: {
title: "غير موجود", title: "غير موجود",
notFound: "إما أن هذه الصفحة خاصة أو غير موجودة.", notFound: "إما أن هذه الصفحة خاصة أو غير موجودة.",
home: "العوده للصفحة الرئيسية",
}, },
folderContent: { folderContent: {
folder: "مجلد", folder: "مجلد",

View File

@ -65,6 +65,7 @@ export default {
error: { error: {
title: "Nicht gefunden", title: "Nicht gefunden",
notFound: "Diese Seite ist entweder nicht öffentlich oder existiert nicht.", notFound: "Diese Seite ist entweder nicht öffentlich oder existiert nicht.",
home: "Return to Homepage",
}, },
folderContent: { folderContent: {
folder: "Ordner", folder: "Ordner",

View File

@ -67,6 +67,7 @@ export interface Translation {
error: { error: {
title: string title: string
notFound: string notFound: string
home: string
} }
folderContent: { folderContent: {
folder: string folder: string

View File

@ -65,6 +65,7 @@ export default {
error: { error: {
title: "Not Found", title: "Not Found",
notFound: "Either this page is private or doesn't exist.", notFound: "Either this page is private or doesn't exist.",
home: "Return to Homepage",
}, },
folderContent: { folderContent: {
folder: "Folder", folder: "Folder",

View File

@ -65,6 +65,7 @@ export default {
error: { error: {
title: "No se encontró.", title: "No se encontró.",
notFound: "Esta página es privada o no existe.", notFound: "Esta página es privada o no existe.",
home: "Regresar a la página principal",
}, },
folderContent: { folderContent: {
folder: "Carpeta", folder: "Carpeta",

View File

@ -65,6 +65,7 @@ export default {
error: { error: {
title: "یافت نشد", title: "یافت نشد",
notFound: "این صفحه یا خصوصی است یا وجود ندارد", notFound: "این صفحه یا خصوصی است یا وجود ندارد",
home: "بازگشت به صفحه اصلی",
}, },
folderContent: { folderContent: {
folder: "پوشه", folder: "پوشه",

View File

@ -65,6 +65,7 @@ export default {
error: { error: {
title: "Introuvable", title: "Introuvable",
notFound: "Cette page est soit privée, soit elle n'existe pas.", notFound: "Cette page est soit privée, soit elle n'existe pas.",
home: "Retour à la page d'accueil",
}, },
folderContent: { folderContent: {
folder: "Dossier", folder: "Dossier",

View File

@ -65,6 +65,7 @@ export default {
error: { error: {
title: "Nem található", title: "Nem található",
notFound: "Ez a lap vagy privát vagy nem létezik.", notFound: "Ez a lap vagy privát vagy nem létezik.",
home: "Vissza a kezdőlapra",
}, },
folderContent: { folderContent: {
folder: "Mappa", folder: "Mappa",

View File

@ -65,6 +65,7 @@ export default {
error: { error: {
title: "Non trovato", title: "Non trovato",
notFound: "Questa pagina è privata o non esiste.", notFound: "Questa pagina è privata o non esiste.",
home: "Ritorna alla home page",
}, },
folderContent: { folderContent: {
folder: "Cartella", folder: "Cartella",

View File

@ -65,6 +65,7 @@ export default {
error: { error: {
title: "Not Found", title: "Not Found",
notFound: "ページが存在しないか、非公開設定になっています。", notFound: "ページが存在しないか、非公開設定になっています。",
home: "ホームページに戻る",
}, },
folderContent: { folderContent: {
folder: "フォルダ", folder: "フォルダ",

View File

@ -65,6 +65,7 @@ export default {
error: { error: {
title: "Not Found", title: "Not Found",
notFound: "페이지가 존재하지 않거나 비공개 설정이 되어 있습니다.", notFound: "페이지가 존재하지 않거나 비공개 설정이 되어 있습니다.",
home: "홈페이지로 돌아가기",
}, },
folderContent: { folderContent: {
folder: "폴더", folder: "폴더",

View File

@ -66,6 +66,7 @@ export default {
error: { error: {
title: "Niet gevonden", title: "Niet gevonden",
notFound: "Deze pagina is niet zichtbaar of bestaat niet.", notFound: "Deze pagina is niet zichtbaar of bestaat niet.",
home: "Keer terug naar de start pagina",
}, },
folderContent: { folderContent: {
folder: "Map", folder: "Map",

View File

@ -65,6 +65,7 @@ export default {
error: { error: {
title: "Nie znaleziono", title: "Nie znaleziono",
notFound: "Ta strona jest prywatna lub nie istnieje.", notFound: "Ta strona jest prywatna lub nie istnieje.",
home: "Powrót do strony głównej",
}, },
folderContent: { folderContent: {
folder: "Folder", folder: "Folder",

View File

@ -65,6 +65,7 @@ export default {
error: { error: {
title: "Não encontrado", title: "Não encontrado",
notFound: "Esta página é privada ou não existe.", notFound: "Esta página é privada ou não existe.",
home: "Retornar a página inicial",
}, },
folderContent: { folderContent: {
folder: "Arquivo", folder: "Arquivo",

View File

@ -66,6 +66,7 @@ export default {
error: { error: {
title: "Pagina nu a fost găsită", title: "Pagina nu a fost găsită",
notFound: "Fie această pagină este privată, fie nu există.", notFound: "Fie această pagină este privată, fie nu există.",
home: "Reveniți la pagina de pornire",
}, },
folderContent: { folderContent: {
folder: "Dosar", folder: "Dosar",

View File

@ -67,6 +67,7 @@ export default {
error: { error: {
title: "Страница не найдена", title: "Страница не найдена",
notFound: "Эта страница приватная или не существует", notFound: "Эта страница приватная или не существует",
home: "Вернуться на главную страницу",
}, },
folderContent: { folderContent: {
folder: "Папка", folder: "Папка",

View File

@ -65,6 +65,7 @@ export default {
error: { error: {
title: "Не знайдено", title: "Не знайдено",
notFound: "Ця сторінка або приватна, або не існує.", notFound: "Ця сторінка або приватна, або не існує.",
home: "Повернутися на головну сторінку",
}, },
folderContent: { folderContent: {
folder: "Папка", folder: "Папка",

View File

@ -65,6 +65,7 @@ export default {
error: { error: {
title: "Không Tìm Thấy", title: "Không Tìm Thấy",
notFound: "Trang này được bảo mật hoặc không tồn tại.", notFound: "Trang này được bảo mật hoặc không tồn tại.",
home: "Trở về trang chủ",
}, },
folderContent: { folderContent: {
folder: "Thư Mục", folder: "Thư Mục",

View File

@ -65,6 +65,7 @@ export default {
error: { error: {
title: "无法找到", title: "无法找到",
notFound: "私有笔记或笔记不存在。", notFound: "私有笔记或笔记不存在。",
home: "返回首页",
}, },
folderContent: { folderContent: {
folder: "文件夹", folder: "文件夹",