feat: implement getDependencyGraph for TagPage (#872)
* feat: implement getDependencyGraph for TagPage * Only add file to dg if it has at least 1 tag
This commit is contained in:
parent
e85ea49000
commit
a67a8d7aa9
@ -35,9 +35,26 @@ export const TagPage: QuartzEmitterPlugin<Partial<FullPageLayout>> = (userOpts)
|
|||||||
getQuartzComponents() {
|
getQuartzComponents() {
|
||||||
return [Head, Header, Body, ...header, ...beforeBody, pageBody, ...left, ...right, Footer]
|
return [Head, Header, Body, ...header, ...beforeBody, pageBody, ...left, ...right, Footer]
|
||||||
},
|
},
|
||||||
async getDependencyGraph(ctx, _content, _resources) {
|
async getDependencyGraph(ctx, content, _resources) {
|
||||||
// TODO implement
|
const graph = new DepGraph<FilePath>()
|
||||||
return 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[]> {
|
async emit(ctx, content, resources): Promise<FilePath[]> {
|
||||||
const fps: FilePath[] = []
|
const fps: FilePath[] = []
|
||||||
|
Loading…
Reference in New Issue
Block a user