| | |
| | | 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 = { |
| | |
| | | </item>` |
| | | |
| | | const items = Array.from(idx) |
| | | .sort((a, b) => byDateAndAlphabetical(cfg)(a[1], b[1])) |
| | | .sort(([_, f1], [__, f2]) => { |
| | | if (f1.date && f2.date) { |
| | | return f2.date.getTime() - f1.date.getTime() |
| | | } else if (f1.date && !f2.date) { |
| | | return -1 |
| | | } else if (!f1.date && f2.date) { |
| | | return 1 |
| | | } |
| | | |
| | | return f1.title.localeCompare(f2.title) |
| | | }) |
| | | .map(([slug, content]) => createURLEntry(simplifySlug(slug), content)) |
| | | .slice(0, limit ?? idx.size) |
| | | .join("") |