You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A list of formatted RSS feed items. See [Astro's RSS items documentation](https://docs.astro.build/en/guides/rss/#generating-items) for usage examples to choose the best option for you.
114
114
115
-
When providing a formatted RSS item list, see the `RSSFeedItem` type reference below:
116
-
117
-
```ts
118
-
typeRSSFeedItem= {
119
-
/** Link to item */
120
-
link:string;
121
-
/** Title of item */
122
-
title:string;
123
-
/** Publication date of item */
124
-
pubDate:Date;
125
-
/** Item description */
126
-
description?:string;
127
-
/** Full content of the item, should be valid HTML */
128
-
content?:string;
129
-
/** Append some other XML-valid data to this item */
130
-
customData?:string;
131
-
};
132
-
```
115
+
When providing a formatted RSS item list, see the [`RSSFeedItem` type reference](#rssfeeditem).
An `RSSFeedItem` is a single item in the list of items in your feed. It represents a story, with `link`, `title`, and `pubDate` fields. There are further optional fields defined below. You can also check the definitions for the fields in the [RSS spec](https://validator.w3.org/feed/docs/rss2.html#ltpubdategtSubelementOfLtitemgt).
191
+
192
+
An example feed item might look like:
193
+
194
+
```js
195
+
const item = {
196
+
title: "Alpha Centauri: so close you can touch it",
197
+
link: "/blog/alpha-centuari",
198
+
pubDate: new Date("2023-06-04"),
199
+
description: "Alpha Centauri is a triple star system, containing Proxima Centauri, the closest star to our sun at only 4.24 light-years away.",
200
+
categories: ["stars", "space"]
201
+
}
202
+
```
203
+
204
+
### `title`
205
+
206
+
Type: `string (required)`
207
+
208
+
The title of the item in the feed.
209
+
210
+
### `link`
211
+
212
+
Type: `string (required)`
213
+
214
+
The URL of the item on the web.
215
+
216
+
### `pubDate`
217
+
218
+
Type: `Date (required)`
219
+
220
+
Indicates when the item was published.
221
+
222
+
### `description`
223
+
224
+
Type: `string (optional)`
225
+
226
+
A synopsis of your item when you are publishing the full content of the item in the `content` field. The `description` may alternatively be the full content of the item in the feed if you are not using the `content` field (entity-coded HTML is permitted).
227
+
228
+
### `content`
229
+
230
+
Type: `string (optional)`
231
+
232
+
The full text content of the item suitable for presentation as HTML. If used, you should also provide a short article summary in the `description` field.
233
+
234
+
See the [recommendations from the RSS spec for how to use and differentiate between `description` and `content`](https://www.rssboard.org/rss-profile#namespace-elements-content-encoded).
235
+
236
+
### `categories`
237
+
238
+
Type: `string[] (optional)`
239
+
240
+
A list of any tags or categories to categorize your content. They will be output as multiple `<category>` elements.
241
+
242
+
### `author`
243
+
244
+
Type: `string (optional)`
245
+
246
+
The email address of the item author. This is useful for indicating the author of a post on multi-author blogs.
247
+
248
+
### `commentsUrl`
249
+
250
+
Type: `string (optional)`
251
+
252
+
The URL of a web page that contains comments on the item.
253
+
254
+
### `source`
255
+
256
+
Type: `object (optional)`
257
+
258
+
An object that defines the `title` and `url` of the original feed for items that have been republished from another source. Both are required properties of `source` for proper attribution.
259
+
260
+
```js
261
+
const item = {
262
+
title: "Alpha Centauri: so close you can touch it",
263
+
link: "/blog/alpha-centuari",
264
+
pubDate: new Date("2023-06-04"),
265
+
description: "Alpha Centauri is a triple star system, containing Proxima Centauri, the closest star to our sun at only 4.24 light-years away.",
The name of the original feed in which the item was published. (Note that this is the feed's title, not the individual article title.)
278
+
279
+
#### `source.url`
280
+
281
+
Type: `string (required)`
282
+
283
+
The URL of the original feed in which the item was published.
284
+
285
+
### `enclosure`
286
+
287
+
Type: `object (optional)`
288
+
289
+
An object to specify properties for an included media source (e.g. a podcast) with three required values: `url`, `length`, and `type`.
290
+
291
+
```js
292
+
const item = {
293
+
title: "Alpha Centauri: so close you can touch it",
294
+
link: "/blog/alpha-centuari",
295
+
pubDate: new Date("2023-06-04"),
296
+
description: "Alpha Centauri is a triple star system, containing Proxima Centauri, the closest star to our sun at only 4.24 light-years away.",
297
+
enclosure: {
298
+
url: "/media/alpha-centauri.aac",
299
+
length: 124568,
300
+
type: "audio/aac"
301
+
}
302
+
}
303
+
```
304
+
305
+
#### `enclosure.url`
306
+
307
+
Type: `string (required)`
308
+
309
+
The URL where the media can be found. If the media is hosted outside of your own domain you must provide a full URL.
310
+
311
+
#### `enclosure.length`
312
+
313
+
Type: `number (required)`
314
+
315
+
The size of the file found at the `url` in bytes.
316
+
317
+
#### `enclosure.type`
318
+
319
+
Type: `string (required)`
320
+
321
+
The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) for the media item found at the `url`.
322
+
205
323
## `rssSchema`
206
324
207
325
When using content collections, you can configure your collection schema to enforce expected [`RSSFeedItem`](#items) properties. Import and apply `rssSchema` to ensure that each collection entry produces a valid RSS feed item:
0 commit comments