From b30a200bd4ddc64f4fd3d2124fcda0b354847073 Mon Sep 17 00:00:00 2001
From: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
Date: Fri, 08 Mar 2024 17:14:22 +0000
Subject: [PATCH] fix(i18n): make sure to use correct fileData for manual localization (#975)
---
quartz/plugins/emitters/folderPage.tsx | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/quartz/plugins/emitters/folderPage.tsx b/quartz/plugins/emitters/folderPage.tsx
index 690fa56..d892b28 100644
--- a/quartz/plugins/emitters/folderPage.tsx
+++ b/quartz/plugins/emitters/folderPage.tsx
@@ -38,12 +38,21 @@
getQuartzComponents() {
return [Head, Header, Body, ...header, ...beforeBody, pageBody, ...left, ...right, Footer]
},
- async getDependencyGraph(_ctx, _content, _resources) {
+ async getDependencyGraph(_ctx, content, _resources) {
// Example graph:
- // nested/file.md --> nested/file.html
- // \-------> nested/index.html
- // TODO implement
- return new DepGraph<FilePath>()
+ // nested/file.md --> nested/index.html
+ // nested/file2.md ------^
+ const graph = new DepGraph<FilePath>()
+
+ content.map(([_tree, vfile]) => {
+ const slug = vfile.data.slug
+ const folderName = path.dirname(slug ?? "") as SimpleSlug
+ if (slug && folderName !== "." && folderName !== "tags") {
+ graph.addEdge(vfile.data.filePath!, joinSegments(folderName, "index.html") as FilePath)
+ }
+ })
+
+ return graph
},
async emit(ctx, content, resources): Promise<FilePath[]> {
const fps: FilePath[] = []
@@ -86,6 +95,7 @@
const externalResources = pageResources(pathToRoot(slug), resources)
const [tree, file] = folderDescriptions[folder]
const componentData: QuartzComponentProps = {
+ ctx,
fileData: file.data,
externalResources,
cfg,
--
Gitblit v1.10.0