面包屑导航通过展示父级文件夹列表,为网站内的页面层级结构提供导航方式。

默认情况下,页面最顶部的元素就是面包屑导航栏(在本页顶部也可以看到!)。

自定义配置

大部分配置可以通过向 Component.Breadcrumbs() 传递选项来实现。

例如,以下是默认配置的示例:

quartz.layout.ts
Component.Breadcrumbs({
  spacerSymbol: "❯", // symbol between crumbs
  rootName: "Home", // name of first/root element
  resolveFrontmatterTitle: true, // whether to resolve folder names through frontmatter titles
  hideOnRoot: true, // whether to hide breadcrumbs on root `index.md` page
  showCurrentPage: true, // whether to display the current page in the breadcrumbs
})

传入自己的选项时,如果想保留某个字段的默认值,可以省略该字段的全部或部分内容。

您也可以通过调整布局文件中的位置(将Component.Breadcrumbs()向上或向下移动)来改变面包屑导航的显示位置。

想要更深度定制?

  • 移除面包屑导航:删除quartz.layout.ts中所有Component.Breadcrumbs()的调用
  • 组件文件:quartz/components/Breadcrumbs.tsx
  • 样式文件:quartz/components/styles/breadcrumbs.scss
  • 脚本文件:内联在quartz/components/Breadcrumbs.tsx