From 1d498facc8f78a3ffbfecd05cc6ecd45e8a4a1ae Mon Sep 17 00:00:00 2001 From: Drew Powers <1369770+drwpow@users.noreply.github.com> Date: Fri, 30 Apr 2021 10:52:00 -0600 Subject: [PATCH] Fix RSS dategen (#156) --- docs/api.md | 6 +++--- test/astro-rss.test.js | 5 +++-- test/fixtures/astro-rss/src/pages/$episodes.astro | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/api.md b/docs/api.md index 805fb6824..e45c87bd8 100644 --- a/docs/api.md +++ b/docs/api.md @@ -47,8 +47,8 @@ const data = Astro.fetchContent('../pages/post/*.md'); // returns an array of po `Astro.request` returns an object with the following properties: -| Name | Type | Description | -| :----- | :------- | :--------------------------------------------------------------------------------------------------------- | +| Name | Type | Description | +| :---- | :---- | :------------------------------------- | | `url` | `URL` | The URL of the request being rendered. | ### `collection` @@ -128,7 +128,7 @@ export async function createCollection() { item: (item) => ({ title: item.title, description: item.description, - pubDate: item.pubDate, + pubDate: item.pubDate + 'Z', // enforce GMT timezone (otherwise it’ll be different based on where it’s built) /** (optional) add arbitrary XML to each */ customData: `${item.type} ${item.duration} diff --git a/test/astro-rss.test.js b/test/astro-rss.test.js index 7bf514875..7b381cb23 100644 --- a/test/astro-rss.test.js +++ b/test/astro-rss.test.js @@ -8,8 +8,9 @@ import { fileURLToPath } from 'url'; const RSS = suite('RSS Generation'); -const snapshot = `<![CDATA[MF Doomcast]]>https://mysite.dev/feed/episodes.xmlen-usMF Doom<![CDATA[Rap Snitch Knishes (feat. Mr. Fantastik)]]>https://mysite.dev/episode/rap-snitch-knishes/Tue, 16 Nov 2004 00:00:00 GMTmusic172true<![CDATA[Fazers]]>https://mysite.dev/episode/fazers/Wed, 02 Jul 2003 23:00:00 GMTmusic197true<![CDATA[Rhymes Like Dimes (feat. Cucumber Slice)]]>https://mysite.dev/episode/rhymes-like-dimes/Mon, 18 Oct 1999 23:00:00 GMTmusic259true' +const snapshot = + `<![CDATA[MF Doomcast]]>https://mysite.dev/feed/episodes.xmlen-usMF Doom<![CDATA[Rap Snitch Knishes (feat. Mr. Fantastik)]]>https://mysite.dev/episode/rap-snitch-knishes/Tue, 16 Nov 2004 00:00:00 GMTmusic172true<![CDATA[Fazers]]>https://mysite.dev/episode/fazers/Thu, 03 Jul 2003 00:00:00 GMTmusic197true<![CDATA[Rhymes Like Dimes (feat. Cucumber Slice)]]>https://mysite.dev/episode/rhymes-like-dimes/Tue, 19 Oct 1999 00:00:00 GMTmusic259true'; const cwd = new URL('./fixtures/astro-rss', import.meta.url); diff --git a/test/fixtures/astro-rss/src/pages/$episodes.astro b/test/fixtures/astro-rss/src/pages/$episodes.astro index a1e3df00b..686770480 100644 --- a/test/fixtures/astro-rss/src/pages/$episodes.astro +++ b/test/fixtures/astro-rss/src/pages/$episodes.astro @@ -21,7 +21,7 @@ export async function createCollection() { title: item.title, link: item.url, description: item.description, - pubDate: item.pubDate, + pubDate: item.pubDate + 'Z', customData: `${item.type}` + `${item.duration}` + `${item.explicit || false}`,