From ce3dd0923b93e8c1cbe95fe584418d6ee5dcba69 Mon Sep 17 00:00:00 2001
From: kabirgh <15871468+kabirgh@users.noreply.github.com>
Date: Thu, 18 Jan 2024 18:56:14 +0000
Subject: [PATCH] refactor: move emit from callback to helper file function (#704)
---
quartz/plugins/emitters/contentIndex.ts | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/quartz/plugins/emitters/contentIndex.ts b/quartz/plugins/emitters/contentIndex.ts
index fa8c2c9..31e1d3e 100644
--- a/quartz/plugins/emitters/contentIndex.ts
+++ b/quartz/plugins/emitters/contentIndex.ts
@@ -6,6 +6,7 @@
import { QuartzEmitterPlugin } from "../types"
import { toHtml } from "hast-util-to-html"
import path from "path"
+import { write } from "./helpers"
export type ContentIndex = Map<FullSlug, ContentDetails>
export type ContentDetails = {
@@ -91,7 +92,7 @@
opts = { ...defaultOptions, ...opts }
return {
name: "ContentIndex",
- async emit(ctx, content, _resources, emit) {
+ async emit(ctx, content, _resources) {
const cfg = ctx.cfg.configuration
const emitted: FilePath[] = []
const linkIndex: ContentIndex = new Map()
@@ -115,7 +116,8 @@
if (opts?.enableSiteMap) {
emitted.push(
- await emit({
+ await write({
+ ctx,
content: generateSiteMap(cfg, linkIndex),
slug: "sitemap" as FullSlug,
ext: ".xml",
@@ -125,7 +127,8 @@
if (opts?.enableRSS) {
emitted.push(
- await emit({
+ await write({
+ ctx,
content: generateRSSFeed(cfg, linkIndex, opts.rssLimit),
slug: "index" as FullSlug,
ext: ".xml",
@@ -146,7 +149,8 @@
)
emitted.push(
- await emit({
+ await write({
+ ctx,
content: JSON.stringify(simplifiedIndex),
slug: fp,
ext: ".json",
--
Gitblit v1.10.0