-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update rss package to return a response (#8198)
- Loading branch information
Showing
4 changed files
with
113 additions
and
30 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
'@astrojs/rss': major | ||
--- | ||
|
||
Update the `rss()` default export to return a `Response` instead of a simple object, which is deprecated in Astro 3.0. If you were directly returning the `rss()` result from an endpoint before, this breaking change should not affect you. | ||
|
||
You can also import `getRssString()` to get the RSS string directly and use it to return your own Response: | ||
|
||
```ts | ||
// src/pages/rss.xml.js | ||
import { getRssString } from '@astrojs/rss'; | ||
|
||
export async function get(context) { | ||
const rssString = await getRssString({ | ||
title: 'Buzz’s Blog', | ||
... | ||
}); | ||
|
||
return new Response(rssString, { | ||
headers: { | ||
'Content-Type': 'application/xml', | ||
}, | ||
}); | ||
} | ||
``` |
This file contains 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
This file contains 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
This file contains 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