From b33f13ccaf4ec14a94ee0ee467dda04cf4981d00 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Mon, 01 Jan 2024 22:20:34 +0000
Subject: [PATCH] fix: dont show last page if folder
---
quartz/plugins/emitters/tagPage.tsx | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/quartz/plugins/emitters/tagPage.tsx b/quartz/plugins/emitters/tagPage.tsx
index fd00d9c..5669119 100644
--- a/quartz/plugins/emitters/tagPage.tsx
+++ b/quartz/plugins/emitters/tagPage.tsx
@@ -6,12 +6,12 @@
import { ProcessedContent, defaultProcessedContent } from "../vfile"
import { FullPageLayout } from "../../cfg"
import {
- CanonicalSlug,
FilePath,
- ServerSlug,
+ FullSlug,
getAllSegmentPrefixes,
joinSegments,
-} from "../../path"
+ pathToRoot,
+} from "../../util/path"
import { defaultListPageLayout, sharedPageComponents } from "../../../quartz.layout"
import { TagContent } from "../../components"
@@ -40,16 +40,17 @@
const tags: Set<string> = new Set(
allFiles.flatMap((data) => data.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes),
)
+
// add base tag
- tags.add("")
+ tags.add("index")
const tagDescriptions: Record<string, ProcessedContent> = Object.fromEntries(
[...tags].map((tag) => {
- const title = tag === "" ? "Tag Index" : `Tag: #${tag}`
+ const title = tag === "index" ? "Tag Index" : `Tag: #${tag}`
return [
tag,
defaultProcessedContent({
- slug: joinSegments("tags", tag) as ServerSlug,
+ slug: joinSegments("tags", tag) as FullSlug,
frontmatter: { title, tags: [] },
}),
]
@@ -67,8 +68,8 @@
}
for (const tag of tags) {
- const slug = joinSegments("tags", tag) as CanonicalSlug
- const externalResources = pageResources(slug, resources)
+ const slug = joinSegments("tags", tag) as FullSlug
+ const externalResources = pageResources(pathToRoot(slug), resources)
const [tree, file] = tagDescriptions[tag]
const componentData: QuartzComponentProps = {
fileData: file.data,
--
Gitblit v1.10.0