Skip to content

Commit

Permalink
Make the RSS feed generator use the published date instead of the mod…
Browse files Browse the repository at this point in the history
…ified date; Updated the generated xml file with what made sense

Also, renamed the subtitle frontmatter property to description and updated the Subtitle component.
  • Loading branch information
joshwingreene committed Mar 15, 2024
1 parent 93c9ab6 commit f57a42b
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion content/blogroll/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Blogroll
subtitle: My favorite digital gardens and blogs
description: My favorite digital gardens and blogs
---
2 changes: 1 addition & 1 deletion content/garden/contributions/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Contributions
subtitle: My contributions to pieces authored by others
description: My contributions to pieces authored by others
tags:
---
2 changes: 1 addition & 1 deletion content/garden/essays/example-essay.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ tags:
- example
title: How you can use Obsidian to do X, Y, and Z
growthStage: evergreen
subtitle: Task, Habits, Notes, Reviews, and etc
description: Task, Habits, Notes, Reviews, and etc
openToContributions: true
contributors:
- Ashley
Expand Down
2 changes: 1 addition & 1 deletion content/garden/essays/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Essays
subtitle: Long-form narratives and opinion pieces
description: Long-form narratives and opinion pieces
---
2 changes: 0 additions & 2 deletions content/garden/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
---
title: Garden
---

Garden
3 changes: 1 addition & 2 deletions content/garden/mocs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
title: MOCs (Maps of Content)
subtitle: MOCs are both an index of links and a narrative that connects ideas.
description: MOCs are both an index of links and a narrative that connects ideas.
---

2 changes: 1 addition & 1 deletion content/garden/notes/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Notes
subtitle: Atomic notes, i.e. single ideas
description: Atomic notes, i.e. single ideas
---
2 changes: 1 addition & 1 deletion content/now/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Now
subtitle: A chronological log of what I'm doing, updated on a quarterly basis.
description: A chronological log of what I'm doing, updated on a quarterly basis.
---
2 changes: 1 addition & 1 deletion content/portfolio/example-portfolio-entry.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Example Portfolio Entry
subtitle: Example Subtitle
description: Example Subtitle
team:
- Jane Doe
- John Smith
Expand Down
1 change: 1 addition & 0 deletions quartz.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ const config: QuartzConfig = {
Plugin.ContentIndex({
enableSiteMap: true,
enableRSS: true,
includeEmptyFiles: false
}),
Plugin.Assets(),
Plugin.Static(),
Expand Down
2 changes: 1 addition & 1 deletion quartz/components/Subtitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default ((opts?: Options) => {
if (options && options.useConfig) {
subtitle = getWhatIDoStr(cfg.landingPageData.intro.whatIDo);
} else {
subtitle = fileData.frontmatter?.subtitle;
subtitle = fileData.frontmatter?.description;
}

if (subtitle) {
Expand Down
2 changes: 1 addition & 1 deletion quartz/components/renderPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export function renderPage(
}
)

console.log("slug -", slug);
// console.log("slug -", slug);

// console.log('header -', header);

Expand Down
2 changes: 1 addition & 1 deletion quartz/i18n/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default {
pages: {
rss: {
recentNotes: "Recent notes",
lastFewNotes: ({ count }) => `Last ${count} notes`,
lastFewNotes: ({ count }) => `Last ${count} items`,
},
error: {
title: "Not Found",
Expand Down
10 changes: 6 additions & 4 deletions quartz/plugins/emitters/contentIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ function generateRSSFeed(cfg: GlobalConfiguration, idx: ContentIndex, limit?: nu
.slice(0, limit ?? idx.size)
.join("")

const authorNameAndPageTitle = `${cfg.landingPageData.authorName}'s ${cfg.pageTitle}`

return `<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>${escapeHTML(cfg.pageTitle)}</title>
<title>${escapeHTML(authorNameAndPageTitle)}</title>
<link>https://${base}</link>
<description>${!!limit ? i18n(cfg.locale).pages.rss.lastFewNotes({ count: limit }) : i18n(cfg.locale).pages.rss.recentNotes} on ${escapeHTML(
cfg.pageTitle,
authorNameAndPageTitle,
)}</description>
<generator>Quartz -- quartz.jzhao.xyz</generator>
<generator>Front Porch -- front-porch.digitalgardeningcollective.com</generator>
${items}
</channel>
</rss>`
Expand Down Expand Up @@ -119,7 +121,7 @@ export const ContentIndex: QuartzEmitterPlugin<Partial<Options>> = (opts) => {
const linkIndex: ContentIndex = new Map()
for (const [tree, file] of content) {
const slug = file.data.slug!
const date = getDate(ctx.cfg.configuration, file.data) ?? new Date()
const date = file.data.dates?.published!
if (opts?.includeEmptyFiles || (file.data.text && file.data.text !== "")) {
linkIndex.set(slug, {
title: file.data.frontmatter?.title!,
Expand Down

0 comments on commit f57a42b

Please sign in to comment.