From da1b6b37fe2ee09359b532f0d2669975b4476c95 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Fri, 14 Mar 2025 17:05:26 +0000
Subject: [PATCH] fix(explorer): fix incorrect recursive case for folder rendering

---
 quartz/plugins/emitters/contentPage.tsx |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/quartz/plugins/emitters/contentPage.tsx b/quartz/plugins/emitters/contentPage.tsx
index f59ff6b..f833930 100644
--- a/quartz/plugins/emitters/contentPage.tsx
+++ b/quartz/plugins/emitters/contentPage.tsx
@@ -94,9 +94,8 @@
 
       return graph
     },
-    async emit(ctx, content, resources): Promise<FilePath[]> {
+    async *emit(ctx, content, resources) {
       const cfg = ctx.cfg.configuration
-      const fps: FilePath[] = []
       const allFiles = content.map((c) => c[1].data)
 
       let containsIndex = false
@@ -106,6 +105,10 @@
           containsIndex = true
         }
 
+        if (file.data.slug?.endsWith("/index")) {
+          continue
+        }
+
         const externalResources = pageResources(pathToRoot(slug), file.data, resources)
         const componentData: QuartzComponentProps = {
           ctx,
@@ -118,14 +121,12 @@
         }
 
         const content = renderPage(cfg, slug, componentData, opts, externalResources)
-        const fp = await write({
+        yield write({
           ctx,
           content,
           slug,
           ext: ".html",
         })
-
-        fps.push(fp)
       }
 
       if (!containsIndex && !ctx.argv.fastRebuild) {
@@ -135,8 +136,6 @@
           ),
         )
       }
-
-      return fps
     },
   }
 }

--
Gitblit v1.10.0