Skip to content

Commit

Permalink
fix: facebook#9136:fix(content-blog): links in feed should be absolute
Browse files Browse the repository at this point in the history
  • Loading branch information
VinceCYLiao committed Jul 18, 2023
1 parent ff22728 commit b607956
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/docusaurus-plugin-content-blog/src/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ async function defaultCreateFeedItems({
const $ = cheerioLoad(content);

const link = normalizeUrl([siteUrl, permalink]);

$(`div#${blogPostContainerID} a`).each((_, elm) => {
const {href} = elm.attribs;
if (href) {
elm.attribs.href = String(new URL(href, link));
}
});

const feedItem: BlogFeedItem = {
title: metadataTitle,
id: link,
Expand Down

0 comments on commit b607956

Please sign in to comment.