From cefbca4753a7d98f93f57a6452a09f6308e2fe27 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Fri, 11 Aug 2023 04:16:07 +0000
Subject: [PATCH] docs on making plugins

---
 quartz/plugins/emitters/contentIndex.ts |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/quartz/plugins/emitters/contentIndex.ts b/quartz/plugins/emitters/contentIndex.ts
index 0b1fec7..a94b552 100644
--- a/quartz/plugins/emitters/contentIndex.ts
+++ b/quartz/plugins/emitters/contentIndex.ts
@@ -68,7 +68,8 @@
   opts = { ...defaultOptions, ...opts }
   return {
     name: "ContentIndex",
-    async emit(_contentDir, cfg, content, _resources, emit) {
+    async emit(ctx, content, _resources, emit) {
+      const cfg = ctx.cfg.configuration
       const emitted: FilePath[] = []
       const linkIndex: ContentIndex = new Map()
       for (const [_tree, file] of content) {
@@ -87,21 +88,19 @@
       }
 
       if (opts?.enableSiteMap) {
-        await emit({
+        emitted.push(await emit({
           content: generateSiteMap(cfg, linkIndex),
           slug: "sitemap" as ServerSlug,
           ext: ".xml",
-        })
-        emitted.push("sitemap.xml" as FilePath)
+        }))
       }
 
       if (opts?.enableRSS) {
-        await emit({
+        emitted.push(await emit({
           content: generateRSSFeed(cfg, linkIndex),
           slug: "index" as ServerSlug,
           ext: ".xml",
-        })
-        emitted.push("index.xml" as FilePath)
+        }))
       }
 
       const fp = path.join("static", "contentIndex") as ServerSlug
@@ -116,12 +115,11 @@
         }),
       )
 
-      await emit({
+      emitted.push(await emit({
         content: JSON.stringify(simplifiedIndex),
         slug: fp,
         ext: ".json",
-      })
-      emitted.push(`${fp}.json` as FilePath)
+      }))
 
       return emitted
     },

--
Gitblit v1.10.0