Public: anyone can read this; the crew can change it.

The JSON feed passes the JSON Feed 1.1 shape on every item #14871

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Every item in /feed.json now carries contenttext. Before this, items had id, url, title and datepublished but no content field, so they failed JSON Feed 1.1. Type check and gate are clean.

Notes

shipped production is serving it deploy 6b7374e

opened this

Every item in /feed.json now carries content_text. Before this, items had id, url, title and date_published but no content field, so they failed JSON Feed 1.1. Type check and gate are clean. I ran the new test/json-feed.test.ts and the existing test/feed-json.test.ts, and both pass. I did not run the full suite.

  • Content field: content_text is the post title as plain text, in src/feed/json_feed.ts. It is not HTML, so there is nothing to escape, and a title like One <b>ship</b> stays literal text.
  • Dates: these were already RFC 3339, since the builder adds the T and Z. The new test now checks this.
  • Test: test/json-feed.test.ts builds a feed from two fixture posts and runs a small 1.1 validator over it. The validator checks top-level version, title and items, each item's id, url and a content field, and RFC 3339 dates. A second test deletes an item's id and confirms the validator reports exactly that.
  • Not done: I did not add content_html, summary, authors or date_modified. The spec makes them optional, and the posts have no body beyond the title.
  • Try it: curl <origin>/feed.json, or run bun test test/json-feed.test.ts.

Closes #14853

commented

Every item in /feed.json now carries content_text. Before this, items had id, url, title and date_published but no content field, so they failed JSON Feed 1.1. Type check and gate are clean. I ran the new test/json-feed.test.ts and the existing test/feed-json.test.ts, and both pass. I did not run the full suite.

  • Content field: content_text is the post title as plain text, in src/feed/json_feed.ts. It is not HTML, so there is nothing to escape, and a title like One <b>ship</b> stays literal text.
  • Dates: these were already RFC 3339, since the builder adds the T and Z. The new test now checks this.
  • Test: test/json-feed.test.ts builds a feed from two fixture posts and runs a small 1.1 validator over it. The validator checks top-level version, title and items, each item's id, url and a content field, and RFC 3339 dates. A second test deletes an item's id and confirms the validator reports exactly that.
  • Not done: I did not add content_html, summary, authors or date_modified. The spec makes them optional, and the posts have no body beyond the title.
  • Try it: curl <origin>/feed.json, or run bun test test/json-feed.test.ts.
Approved

Small, single-purpose, and it does what the issue asked. The preview /feed.json items now carry content_text beside id, url, title and an RFC 3339 date_published; top level has version, title, items. Titles stay raw text in JSON, so nothing to escape. The test builds a feed from fixture posts, validates it, and a deleted id fails it. Two things I would do next: (1) say in docs/features/feed-json.md that each item carries content_text (the title) so readers know the field; (2) add a validator case for a bad date and for an item with no content, so those branches of the validator are proven to fail too.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs