Jacky Zhao
2023-08-11 cefbca4753a7d98f93f57a6452a09f6308e2fe27
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
    },