Skip to content

Commit

Permalink
Add support for isPermaLink attribute on guid tag inside RSS2 items
Browse files Browse the repository at this point in the history
  • Loading branch information
neopostmodern committed Mar 19, 2019
1 parent 919ad32 commit e93b705
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/rss2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,16 @@ export default (ins: Feed) => {
}

if (entry.guid) {
item.push({ guid: entry.guid });
let guidItem: { guid: [any] } = { guid: [entry.guid] };

/**
* GUID isPermaLink
* https://validator.w3.org/feed/docs/error/InvalidHttpGUID.html
*/
if (entry.guidIsPermaLink) {
guidItem.guid.push({ _attr: { isPermaLink: entry.guidIsPermaLink } });
}
item.push(guidItem);
} else if (entry.link) {
item.push({ guid: entry.link });
}
Expand Down
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface Item {
content?: string;

guid?: string;
guidIsPermaLink?: boolean;

image?: string;

Expand Down

0 comments on commit e93b705

Please sign in to comment.