Jacky Zhao
2023-07-23 7db2eda76cf51fd631d385c12a7b411339406067
quartz/plugins/emitters/contentIndex.ts
@@ -5,12 +5,12 @@
export type ContentIndex = Map<CanonicalSlug, ContentDetails>
export type ContentDetails = {
  title: string,
  links: CanonicalSlug[],
  tags: string[],
  content: string,
  date?: Date,
  description?: string,
  title: string
  links: CanonicalSlug[]
  tags: string[]
  content: string
  date?: Date
  description?: string
}
interface Options {
@@ -31,7 +31,9 @@
    <loc>https://${base}/${slug}</loc>
    <lastmod>${content.date?.toISOString()}</lastmod>
  </url>`
  const urls = Array.from(idx).map(([slug, content]) => createURLEntry(slug, content)).join("")
  const urls = Array.from(idx)
    .map(([slug, content]) => createURLEntry(slug, content))
    .join("")
  return `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">${urls}</urlset>`
}
@@ -47,7 +49,9 @@
    <pubDate>${content.date?.toUTCString()}</pubDate>
  </items>`
  const items = Array.from(idx).map(([slug, content]) => createURLEntry(slug, content)).join("")
  const items = Array.from(idx)
    .map(([slug, content]) => createURLEntry(slug, content))
    .join("")
  return `<rss xmlns:atom="http://www.w3.org/2005/atom" version="2.0">
    <channel>
      <title>${cfg.pageTitle}</title>
@@ -77,7 +81,7 @@
          tags: file.data.frontmatter?.tags ?? [],
          content: file.data.text ?? "",
          date: date,
          description: file.data.description ?? ""
            description: file.data.description ?? "",
        })
        }
      }
@@ -86,7 +90,7 @@
        await emit({
          content: generateSiteMap(cfg, linkIndex),
          slug: "sitemap" as ServerSlug,
          ext: ".xml"
          ext: ".xml",
        })
        emitted.push("sitemap.xml" as FilePath)
      }
@@ -95,7 +99,7 @@
        await emit({
          content: generateRSSFeed(cfg, linkIndex),
          slug: "index" as ServerSlug,
          ext: ".xml"
          ext: ".xml",
        })
        emitted.push("index.xml" as FilePath)
      }
@@ -109,7 +113,7 @@
          delete content.description
          delete content.date
          return [slug, content]
        })
        }),
      )
      await emit({