Rune Antonsen
2023-11-20 9a599aebeada7f95170dac98c3f30023d9e7453f
quartz/components/Breadcrumbs.tsx
@@ -25,6 +25,10 @@
   * Wether to display breadcrumbs on root `index.md`
   */
  hideOnRoot: boolean
  /**
   * Wether to display the current page in the breadcrumbs.
   */
  showCurrentPage: boolean
}
const defaultOptions: BreadcrumbOptions = {
@@ -32,6 +36,7 @@
  rootName: "Home",
  resolveFrontmatterTitle: true,
  hideOnRoot: true,
  showCurrentPage: true,
}
function formatCrumb(displayName: string, baseSlug: FullSlug, currentSlug: SimpleSlug): CrumbData {
@@ -95,10 +100,12 @@
      }
      // Add current file to crumb (can directly use frontmatter title)
      crumbs.push({
        displayName: fileData.frontmatter!.title,
        path: "",
      })
      if (options.showCurrentPage) {
        crumbs.push({
          displayName: fileData.frontmatter!.title,
          path: "",
        })
      }
    }
    return (
      <nav class={`breadcrumb-container ${displayClass ?? ""}`} aria-label="breadcrumbs">