diff --git a/quartz/components/Breadcrumbs.tsx b/quartz/components/Breadcrumbs.tsx index 5144a314d..63ff7daa8 100644 --- a/quartz/components/Breadcrumbs.tsx +++ b/quartz/components/Breadcrumbs.tsx @@ -3,6 +3,7 @@ import breadcrumbsStyle from "./styles/breadcrumbs.scss" import { FullSlug, SimpleSlug, resolveRelative, simplifySlug } from "../util/path" import { classNames } from "../util/lang" import { trieFromAllFiles } from "../util/ctx" +import { i18n } from "../i18n" type CrumbData = { displayName: string @@ -30,7 +31,7 @@ interface BreadcrumbOptions { const defaultOptions: BreadcrumbOptions = { spacerSymbol: "❯", - rootName: "Home", + rootName: "", resolveFrontmatterTitle: true, showCurrentPage: true, } @@ -49,6 +50,7 @@ export default ((opts?: Partial) => { allFiles, displayClass, ctx, + cfg, }: QuartzComponentProps) => { const trie = (ctx.trie ??= trieFromAllFiles(allFiles)) const slugParts = fileData.slug!.split("/") @@ -61,7 +63,7 @@ export default ((opts?: Partial) => { const crumbs: CrumbData[] = pathNodes.map((node, idx) => { const crumb = formatCrumb(node.displayName, fileData.slug!, simplifySlug(node.slug)) if (idx === 0) { - crumb.displayName = options.rootName + crumb.displayName = options.rootName !== "" ? options.rootName : i18n(cfg.locale).components.breadcrumbs.rootName; } // For last node (current page), set empty path diff --git a/quartz/i18n/locales/definition.ts b/quartz/i18n/locales/definition.ts index f22538fca..9966a9e64 100644 --- a/quartz/i18n/locales/definition.ts +++ b/quartz/i18n/locales/definition.ts @@ -62,6 +62,9 @@ export interface Translation { contentMeta: { readingTime: (variables: { minutes: number }) => string } + breadcrumbs: { + rootName: string + } } pages: { rss: { diff --git a/quartz/i18n/locales/en-GB.ts b/quartz/i18n/locales/en-GB.ts index 80e52bf3c..84956f5d0 100644 --- a/quartz/i18n/locales/en-GB.ts +++ b/quartz/i18n/locales/en-GB.ts @@ -59,6 +59,9 @@ export default { contentMeta: { readingTime: ({ minutes }) => `${minutes} min read`, }, + breadcrumbs: { + rootName: "Home" + }, }, pages: { rss: { diff --git a/quartz/i18n/locales/en-US.ts b/quartz/i18n/locales/en-US.ts index e1111e9ab..d62f81551 100644 --- a/quartz/i18n/locales/en-US.ts +++ b/quartz/i18n/locales/en-US.ts @@ -59,6 +59,9 @@ export default { contentMeta: { readingTime: ({ minutes }) => `${minutes} min read`, }, + breadcrumbs: { + rootName: "Home" + }, }, pages: { rss: { diff --git a/quartz/i18n/locales/hu-HU.ts b/quartz/i18n/locales/hu-HU.ts index 2a4f07727..66ac89e9e 100644 --- a/quartz/i18n/locales/hu-HU.ts +++ b/quartz/i18n/locales/hu-HU.ts @@ -59,6 +59,9 @@ export default { contentMeta: { readingTime: ({ minutes }) => `${minutes} perces olvasás`, }, + breadcrumbs: { + rootName: "Otthon" + }, }, pages: { rss: {