Quartz 可以根据筛选和排序条件生成最近笔记列表。虽然默认布局中不包含此组件,但您可以通过在 quartz.layout.ts 中使用 Component.RecentNotes 来添加它。

自定义选项

  • 修改”最近笔记”标题:向 Component.RecentNotes({ title: "近期文章" }) 传递额外参数
  • 修改显示数量:向 Component.RecentNotes({ limit: 5 }) 传递额外参数
  • 显示笔记标签(默认为true):Component.RecentNotes({ showTags: false })
  • 显示”查看更多”链接:向 Component.RecentNotes({ linkToMore: "tags/components" }) 传递额外参数。该字段应为已存在页面的完整slug
  • 自定义筛选:向 Component.RecentNotes({ filter: someFilterFunction }) 传递额外参数。过滤函数应具有 (f: QuartzPluginData) => boolean 的签名
  • 自定义排序:向 Component.RecentNotes({ sort: someSortFunction }) 传递额外参数。默认按日期排序,字母顺序作为平局决胜条件。排序函数应具有 (f1: QuartzPluginData, f2: QuartzPluginData) => number 的签名。示例可参考 quartz/components/PageList.tsx 中的 byDateAndAlphabetical
  • 组件文件:quartz/components/RecentNotes.tsx
  • 样式文件:quartz/components/styles/recentNotes.scss