Skip to content

Commit

Permalink
fix link to posts in xml file
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuiliao committed Dec 17, 2024
1 parent 58e8043 commit 11cfe91
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/createFeed.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import process from 'process';
{link: "https://react-spectrum.adobe.com/"},
{description: "A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences."},
{language: "en-US"},
...buildFeed(posts)
...buildFeed(type, posts)
],
},
],
Expand Down Expand Up @@ -81,15 +81,18 @@ function getFeed(type) {
index++;
}

let post = {date: date, description: description, title: title};
let f = file.split('/');
let fileName = f[f.length - 1].replace('.mdx', '');

let post = {date: date, description: description, title: title, fileName: fileName};
posts.push(post);
}

posts = posts.sort((a, b) => a.date < b.date ? 1 : -1).slice(0, 5);
return posts;
}

function buildFeed(posts) {
function buildFeed(type, posts) {
const feedItems = [];

feedItems.push(
Expand All @@ -100,7 +103,7 @@ function buildFeed(posts) {
{pubDate: new Date(post.date).toUTCString(),},
{guid: [
{ _attr: { isPermaLink: true } },
`https://react-spectrum.adobe.com/releases/${post.date}.html`,
`https://react-spectrum.adobe.com/${type}/${post.fileName}.html`,
],
},
{description: {
Expand Down

0 comments on commit 11cfe91

Please sign in to comment.