From a67a8d7aa9da06d8f87d0f48bac630728a4ea394 Mon Sep 17 00:00:00 2001
From: kabirgh <15871468+kabirgh@users.noreply.github.com>
Date: Mon, 19 Feb 2024 18:58:15 +0000
Subject: [PATCH] feat: implement getDependencyGraph for TagPage (#872)
---
quartz/plugins/emitters/tagPage.tsx | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/quartz/plugins/emitters/tagPage.tsx b/quartz/plugins/emitters/tagPage.tsx
index 332c758..3eb6975 100644
--- a/quartz/plugins/emitters/tagPage.tsx
+++ b/quartz/plugins/emitters/tagPage.tsx
@@ -35,9 +35,26 @@
getQuartzComponents() {
return [Head, Header, Body, ...header, ...beforeBody, pageBody, ...left, ...right, Footer]
},
- async getDependencyGraph(ctx, _content, _resources) {
- // TODO implement
- return new DepGraph<FilePath>()
+ async getDependencyGraph(ctx, content, _resources) {
+ const graph = new DepGraph<FilePath>()
+
+ for (const [_tree, file] of content) {
+ const sourcePath = file.data.filePath!
+ const tags = (file.data.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes)
+ // if the file has at least one tag, it is used in the tag index page
+ if (tags.length > 0) {
+ tags.push("index")
+ }
+
+ for (const tag of tags) {
+ graph.addEdge(
+ sourcePath,
+ joinSegments(ctx.argv.output, "tags", tag + ".html") as FilePath,
+ )
+ }
+ }
+
+ return graph
},
async emit(ctx, content, resources): Promise<FilePath[]> {
const fps: FilePath[] = []
--
Gitblit v1.10.0