Closed robmen closed 8 months ago
All elements of an item are optional, however at least one of title or description must be present. -- cyber.harvard.edu/rss/rss.html#hrelementsOfLtitemgt
If I understand this correctly, it means that if an item has no elements (because it's optional), then at least a title
or description
needs to exist. It doesn't mean that on a proper formed item with title
, link
, and description
, you can choose either a title
or description
to exist.
Plus I think it's fair for Astro to enforce some defaults here to generate a better RSS feed. pubDate
is also optional per the spec, but Astro enforces it. So I'm leaning towards this not being an issue.
If I understand this correctly, it means that if an item has no elements (because it's optional), then at least a title or description needs to exist.
Correct.
It doesn't mean that on a proper formed item with title, link, and description, you can choose either a title or description to exist.
This is not correct. The designer of the RSS specifications, Dave Winer - @scripting, regularly calls out that RSS items should not require titles. It is an important distinction he makes.
Title-less RSS items allow one to build a (for lack of a better word) "micro-blogging" site like Twitter or Bluesky. In fact, Bluesky already produces RSS feeds for users and they do not have titles.
I hit this issue when attempting to build a textcasting system using Astro. Textcasting is a (IMHO) honorable effort by @scripting to reboot blogging and personal publication. Title-less posts are specifically called out twice:
Titles are optional. Any post can have a title, or not. If you're writing something like a quick social media post, there's no need for a title. But if you're writing something longer, you might need one. It must be up to the writer to decide if a post gets a title. https://textcasting.org/#1683634956000 ... For example, there was a time when the leading feed reader app required posts to have titles, and the leading microblogging site said they couldn't have them. That meant not only didn't they share data, they couldn't. https://textcasting.org/#1670873252000
Please do not close this as a non-issue. I really hope that rss()
would be capable of following the RSS spec.
You don't have to go by what I say, it's very clear in the RSS 2.0 spec.
All elements of an item are optional, however at least one of title or description must be present.
It was put there so that writers could choose whether an item required a title or not. The idea was to empower the writer, as it is with textcasting, as you note.
I guessed that was the problem. Unfortunately, my Zod-fu is not strong enough to know how to represent "at least one of" across multiple fields.
I am interested in the solution because I have a similar case in my own config.ts
.
In my config.ts
, I made all the fields .optional()
and gave up on the validation. 😢 I suppose that could be an option here, but I expect you all know much more about Zod than I do and might know a way to maintain the validation.
I took another look at the spec, and I think I was confused between a "channel" and an "item" where both have overlapping sub-elements that are required/optional. So I suppose we can loosen up the schema for "item" in Astro today. But on top of allowing either title and description, we should also make pubDate
and link
optional, and adjust the error message.
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
The RSS specification calls out that the item title is optional if the item description is present:
However the
rss()
in astro requires an title:What's the expected result?
Do not require a
title
element for RSS items if adescription
element is present.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-aoal5a?file=src%2Fcontent%2Fblog%2Fpost-only-desc.md
Participation