Skip to content

Commit

Permalink
Add via to bookmarks JSON feed
Browse files Browse the repository at this point in the history
  • Loading branch information
LkeMitchll committed Dec 22, 2023
1 parent 0f0ffad commit 522f55f
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/feeds/bookmarks.11ty.cjs
Expand Up @@ -11,13 +11,19 @@ class Posts {

render(data) {
const entries = [...data.bookmarks].reverse();
const bookmarks = entries.map((bookmark) => ({
id: bookmark.id,
content_html: `<p>Link: <a href="${bookmark.url}">${bookmark.title}</a></p><ul><li>Added: ${bookmark.date}</li><li>Tag: ${bookmark.tag}</li></ul>`,
url: bookmark.url,
date_published: bookmark.date,
title: bookmark.title,
}));
const bookmarks = entries.map((bookmark) => {
let via = '';
if (bookmark.viaURL) {
via = `<li>Via <a href="${bookmark.viaURL}">${bookmark.viaName}</a>`;
}
return {
id: bookmark.id,
content_html: `<p>Link: <a href="${bookmark.url}">${bookmark.title}</a></p><ul>${via}<li>Added: ${bookmark.date}</li><li>Tag: ${bookmark.tag}</li></ul>`,
url: bookmark.url,
date_published: bookmark.date,
title: bookmark.title,
};
});

const wrapper = {
version: 'https://jsonfeed.org/version/1.1',
Expand Down

0 comments on commit 522f55f

Please sign in to comment.