aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2024-09-21 18:51:21 +0000
committerRuben Beltran del Rio <git@r.bdr.sh>2024-09-21 18:51:21 +0000
commitfe344d4e7fcaf72b4fab2ce4c6b017daedda8450 (patch)
tree837252fedc0df07380dd228f069db731e2989456
parentfdb5251ccba2456745ca43801a6a8ce040177771 (diff)
Adjust title logic
-rw-r--r--index.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/index.js b/index.js
index ef06ad9..275b96c 100644
--- a/index.js
+++ b/index.js
@@ -26,14 +26,17 @@ const internals = {
return posts.map((post) => {
- return `=> ${post.url} ${post.title}\n${post.notes}`;
+ const title = post.title || post.website_title
+ return `=> ${post.url} ${title}\n${post.notes}`;
}).join('\n\n');
},
getTitle(posts) {
+ const title = posts[0].title || posts[0].website_title
+
if (posts.length === 1) {
- return `Link: ${posts[0].title}`;
+ return `Link: ${title}`;
}
return `${posts.length} links for ${internals.date}`;
},
@@ -75,9 +78,6 @@ const internals = {
async updateBookmark(bookmark) {
- console.log(bookmark.tag_names);
- console.log(bookmark.tag_names.map((tag) => tag === 'linkblog' ? 'linkblog-posted' : tag));
-
const url = join(internals.apiUrl, 'bookmarks', `${bookmark.id}`)
const response = await fetch(url, {
method: 'PATCH',
@@ -91,10 +91,6 @@ const internals = {
Authorization: `Token ${internals.apiToken}`
}
});
-
- const data = await response.text();
- console.log(url);
- console.log(data);
}
};