| | |
| | | import { QuartzEmitterPlugin } from "../types" |
| | | import { toHtml } from "hast-util-to-html" |
| | | import path from "path" |
| | | import { byDateAndAlphabetical } from "../../components/PageList" |
| | | |
| | | export type ContentIndex = Map<FullSlug, ContentDetails> |
| | | export type ContentDetails = { |
| | |
| | | links: SimpleSlug[] |
| | | tags: string[] |
| | | content: string |
| | | richContent?: string |
| | | date?: Date |
| | | description?: string |
| | | } |
| | |
| | | <title>${escapeHTML(content.title)}</title> |
| | | <link>${root}/${encodeURI(slug)}</link> |
| | | <guid>${root}/${encodeURI(slug)}</guid> |
| | | <description>${content.content}</description> |
| | | <description>${content.richContent ?? content.description}</description> |
| | | <pubDate>${content.date?.toUTCString()}</pubDate> |
| | | </item>` |
| | | |
| | | const items = Array.from(idx) |
| | | .sort((a, b) => byDateAndAlphabetical(cfg)(a[1], b[1])) |
| | | .map(([slug, content]) => createURLEntry(simplifySlug(slug), content)) |
| | | .slice(0, limit ?? idx.size) |
| | | .join("") |
| | |
| | | <channel> |
| | | <title>${escapeHTML(cfg.pageTitle)}</title> |
| | | <link>${root}</link> |
| | | <description>${!!limit ? `Last ${limit} notes` : "Recent notes"} on ${ |
| | | cfg.pageTitle |
| | | }</description> |
| | | <description>${!!limit ? `Last ${limit} notes` : "Recent notes"} on ${escapeHTML( |
| | | cfg.pageTitle, |
| | | )}</description> |
| | | <generator>Quartz -- quartz.jzhao.xyz</generator> |
| | | ${items} |
| | | </channel> |
| | |
| | | title: file.data.frontmatter?.title!, |
| | | links: file.data.links ?? [], |
| | | tags: file.data.frontmatter?.tags ?? [], |
| | | content: opts?.rssFullHtml |
| | | content: file.data.text ?? "", |
| | | richContent: opts?.rssFullHtml |
| | | ? escapeHTML(toHtml(tree as Root, { allowDangerousHtml: true })) |
| | | : file.data.description ?? "", |
| | | : undefined, |
| | | date: date, |
| | | description: file.data.description ?? "", |
| | | }) |