From d2be097b7698c2548915c386aab07ceb320855aa Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Sun, 17 Dec 2023 23:09:51 +0000
Subject: [PATCH] feat: include tag hierarchies in tag listing, sort tag listing
---
quartz/plugins/emitters/tagPage.tsx | 1 +
quartz/components/pages/TagContent.tsx | 6 +++++-
2 files changed, 6 insertions(+), 1 deletions(-)
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 @@
: 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<string, QuartzPluginData[]> = 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 @@
const tags: Set<string> = new Set(
allFiles.flatMap((data) => data.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes),
)
+
// add base tag
tags.add("index")
--
Gitblit v1.10.0