From b9dee0775cda4bb29da1a5fb5b000ddcd4dc1f6e Mon Sep 17 00:00:00 2001
From: kon-foo <25391223+kon-foo@users.noreply.github.com>
Date: Mon, 26 Feb 2024 21:55:47 +0000
Subject: [PATCH] docs: Clarifications in the Explorer Docs (#938)
---
quartz/plugins/emitters/tagPage.tsx | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/quartz/plugins/emitters/tagPage.tsx b/quartz/plugins/emitters/tagPage.tsx
index 3e450f6..6f65ae4 100644
--- a/quartz/plugins/emitters/tagPage.tsx
+++ b/quartz/plugins/emitters/tagPage.tsx
@@ -15,6 +15,8 @@
import { defaultListPageLayout, sharedPageComponents } from "../../../quartz.layout"
import { TagContent } from "../../components"
import { write } from "./helpers"
+import { i18n } from "../../i18n"
+import DepGraph from "../../depgraph"
export const TagPage: QuartzEmitterPlugin<Partial<FullPageLayout>> = (userOpts) => {
const opts: FullPageLayout = {
@@ -33,6 +35,27 @@
getQuartzComponents() {
return [Head, Header, Body, ...header, ...beforeBody, pageBody, ...left, ...right, Footer]
},
+ 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[] = []
const allFiles = content.map((c) => c[1].data)
@@ -47,7 +70,10 @@
const tagDescriptions: Record<string, ProcessedContent> = Object.fromEntries(
[...tags].map((tag) => {
- const title = tag === "index" ? "Tag Index" : `Tag: #${tag}`
+ const title =
+ tag === "index"
+ ? i18n(cfg.locale).pages.tagContent.tagIndex
+ : `${i18n(cfg.locale).pages.tagContent.tag}: #${tag}`
return [
tag,
defaultProcessedContent({
@@ -73,6 +99,7 @@
const externalResources = pageResources(pathToRoot(slug), resources)
const [tree, file] = tagDescriptions[tag]
const componentData: QuartzComponentProps = {
+ ctx,
fileData: file.data,
externalResources,
cfg,
@@ -81,7 +108,7 @@
allFiles,
}
- const content = renderPage(slug, componentData, opts, externalResources)
+ const content = renderPage(cfg, slug, componentData, opts, externalResources)
const fp = await write({
ctx,
content,
--
Gitblit v1.10.0