From d2be097b7698c2548915c386aab07ceb320855aa Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sun, 17 Dec 2023 15:09:51 -0800 Subject: [PATCH] feat: include tag hierarchies in tag listing, sort tag listing --- quartz/components/pages/TagContent.tsx | 6 +++++- quartz/plugins/emitters/tagPage.tsx | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/quartz/components/pages/TagContent.tsx b/quartz/components/pages/TagContent.tsx index a495af5..890755b 100644 --- a/quartz/components/pages/TagContent.tsx +++ b/quartz/components/pages/TagContent.tsx @@ -28,7 +28,11 @@ function TagContent(props: QuartzComponentProps) { : htmlToJsx(fileData.filePath!, tree) if (tag === "/") { - const tags = [...new Set(allFiles.flatMap((data) => data.frontmatter?.tags ?? []))] + const tags = [ + ...new Set( + allFiles.flatMap((data) => data.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes), + ), + ].sort((a, b) => a.localeCompare(b)) const tagItemMap: Map = new Map() for (const tag of tags) { tagItemMap.set(tag, allPagesWithTag(tag)) diff --git a/quartz/plugins/emitters/tagPage.tsx b/quartz/plugins/emitters/tagPage.tsx index ad5e1d6..5669119 100644 --- a/quartz/plugins/emitters/tagPage.tsx +++ b/quartz/plugins/emitters/tagPage.tsx @@ -40,6 +40,7 @@ export const TagPage: QuartzEmitterPlugin = (userOpts) => { const tags: Set = new Set( allFiles.flatMap((data) => data.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes), ) + // add base tag tags.add("index")