Skip to content

Commit 733794c

Browse files
authored
Develop (#33)
2 parents 581cbeb + 583ead2 commit 733794c

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
},
1414
"scripts": {
1515
"quartz": "./quartz/bootstrap-cli.mjs",
16-
"docs": "npx quartz build --serve -d docs",
16+
"docs": "npx . --serve -d docs",
1717
"check": "tsc --noEmit && npx prettier . --check",
1818
"format": "npx prettier . --write",
1919
"test": "tsx ./quartz/util/path.test.ts && tsx ./quartz/depgraph.test.ts",
2020
"profile": "0x -D prof ./quartz/bootstrap-cli.mjs build --concurrency=1",
2121
"check-urls": "npx tsx ./url-check.ts",
22-
"build": "npx -y quartz build",
23-
"serve": "npx -y quartz build --serve"
22+
"build": "npx . build",
23+
"serve": "npx . build --serve"
2424
},
2525
"engines": {
2626
"npm": ">=9.3.1",

quartz.config.ts

+3
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ const config: QuartzConfig = {
8787
includeEmptyFiles: false,
8888
rssFullHtml: true,
8989
rssLimit: Infinity,
90+
filterFn: ([fullSlug, details]) => {
91+
return !fullSlug.startsWith("projects/Breadboard/")
92+
},
9093
}),
9194
Plugin.Assets(),
9295
Plugin.Static(),

quartz/plugins/emitters/contentIndex.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ export type ContentDetails = {
2020
description?: string
2121
}
2222

23+
export type FilterFn = ([fullSlug, ContentDetails]: [FullSlug, ContentDetails]) => boolean
24+
2325
interface Options {
2426
enableSiteMap: boolean
2527
enableRSS: boolean
2628
rssLimit?: number
2729
rssFullHtml: boolean
2830
includeEmptyFiles: boolean
31+
filterFn?: FilterFn
2932
}
3033

3134
const defaultOptions: Options = {
@@ -48,7 +51,12 @@ function generateSiteMap(cfg: GlobalConfiguration, idx: ContentIndex): string {
4851
return `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">${urls}</urlset>`
4952
}
5053

51-
function generateRSSFeed(cfg: GlobalConfiguration, idx: ContentIndex, limit?: number): string {
54+
function generateRSSFeed(
55+
cfg: GlobalConfiguration,
56+
idx: ContentIndex,
57+
limit?: number,
58+
filterFn: FilterFn = () => true,
59+
): string {
5260
const base = cfg.baseUrl ?? ""
5361

5462
const createURLEntry = (slug: SimpleSlug, content: ContentDetails): string => `<item>
@@ -60,6 +68,8 @@ function generateRSSFeed(cfg: GlobalConfiguration, idx: ContentIndex, limit?: nu
6068
</item>`
6169

6270
const items = Array.from(idx)
71+
// .filter(filterFn?.bind(null) ?? (() => true))
72+
.filter(filterFn)
6373
.sort(([_, f1], [__, f2]) => {
6474
if (f1.date && f2.date) {
6575
return f2.date.getTime() - f1.date.getTime()
@@ -150,7 +160,7 @@ export const ContentIndex: QuartzEmitterPlugin<Partial<Options>> = (opts) => {
150160
emitted.push(
151161
await write({
152162
ctx,
153-
content: generateRSSFeed(cfg, linkIndex, opts.rssLimit),
163+
content: generateRSSFeed(cfg, linkIndex, opts.rssLimit, opts.filterFn),
154164
slug: "index" as FullSlug,
155165
ext: ".xml",
156166
}),

0 commit comments

Comments
 (0)