Add featured image, tags, and categories to RSS feed generation - #122
Draft
bencounsell wants to merge 1 commit into
Draft
Add featured image, tags, and categories to RSS feed generation#122bencounsell wants to merge 1 commit into
bencounsell wants to merge 1 commit into
Conversation
…port
RSS item output now includes:
1. Featured/header image via <enclosure>, <media:content>, and
<media:thumbnail> — uses the existing 'image' frontmatter key
(string URL or object with 'src' property, matching CMS conventions)
2. Tags from frontmatter via <category> elements — uses the existing
'tags' frontmatter key (array of strings or enriched tag objects)
3. Categories from frontmatter via <category> elements — uses a new
'categories' frontmatter key (array of strings)
New files:
- shared/rss/rss-item-builder.js: JavaScript RSS 2.0 feed builder with
support for Media RSS namespace (xmlns:media) and Atom self-link
- shared/templates/rss/feed.php: Server-side PHP template that reads
markdown frontmatter from a CMS content directory and generates
standards-compliant RSS 2.0 XML
- test/rss-feed.test.mjs: 23 tests covering all RSS generation paths
including image enclosure, media:content, media:thumbnail, category
emission for tags and categories, XML escaping, and full feed
round-trip with generated fixture
Frontmatter keys (all optional, matching existing CMS conventions):
title — post title (string)
date_published — publication date (ISO 8601)
description — plain-text excerpt/summary
image — featured image URL (string) or { src: URL }
tags — array of tag labels or enriched { title, url } objects
categories — array of category labels
link — item permalink
guid — globally unique identifier (defaults to link)
Related to #71
Co-authored-by: Ben Counsell <bencounsell@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements RSS feed generation that includes featured images, tags, and categories from markdown frontmatter — addressing the customer request in the forum thread.
Related to #71
What changed
New: RSS feed builder (
shared/rss/rss-item-builder.js)A JavaScript RSS 2.0 feed builder that generates standards-compliant XML with support for:
<enclosure>— standard RSS 2.0 image attachment<media:content>— Media RSS (Yahoo mrss) for richer feed readers<media:thumbnail>— Media RSS thumbnail hint<category>elements (one per tag)<category>elements (one per category)The builder accepts the
imagefrontmatter key in both forms used by the CMS:image: "https://example.com/hero.jpg"image: { src: "https://example.com/hero.jpg" }New: PHP feed template (
shared/templates/rss/feed.php)A server-side PHP template that reads markdown files with YAML frontmatter from a CMS content directory and produces RSS 2.0 XML. Follows the same pattern as the gallery's remote-folder PHP templates.
New: Tests (
test/rss-feed.test.mjs)23 tests covering:
<enclosure>,<media:content>,<media:thumbnail>emission for featured images<category>emission for string tags, enriched tag objects, and categoriesFrontmatter keys
All optional. These reuse existing CMS markdown collection conventions — no new keys were invented for fields the CMS already supports.
titledate_publisheddescriptionimage{ src }tags{ title, url }[]<category>)categories<category>)linkguidlink)Test results
All 23 new RSS tests pass alongside the 92 existing component tests.