chore: more tags
This commit is contained in:
parent
408b7bcc2c
commit
35848faf2d
4 changed files with 21 additions and 2 deletions
|
@ -50,14 +50,19 @@ export const tagMap = (collection) => {
|
|||
const collectionData = collection.getAll()[0]
|
||||
const posts = collectionData.data.collections.posts
|
||||
const links = collectionData.data.collections.links
|
||||
const books = collectionData.data.books
|
||||
|
||||
if (posts) {
|
||||
posts.forEach((post) => {
|
||||
const url = post.url.includes('http') ? post.url : `https://coryd.dev${post.url}`
|
||||
const tagString = [...new Set(post.data.tags.map((tag) => tagAliases[tag.toLowerCase()]))]
|
||||
const tagString = [...new Set(post.data.tags?.map((tag) => tagAliases[tag.toLowerCase()]))]
|
||||
.join(' ')
|
||||
.trim()
|
||||
if (tagString) tags[url] = tagString.replace(/\s+/g,' ')
|
||||
})
|
||||
}
|
||||
|
||||
if (links) {
|
||||
links.forEach((link) => {
|
||||
const url = link.data.link
|
||||
const tagString = [...new Set(link.data.tags?.map((tag) => tagAliases[tag.toLowerCase()]))]
|
||||
|
@ -66,6 +71,17 @@ export const tagMap = (collection) => {
|
|||
if (tagString) tags[url] = tagString.replace(/\s+/g,' ')
|
||||
})
|
||||
}
|
||||
|
||||
if (books) {
|
||||
books.forEach((book) => {
|
||||
const tagString = book?.['tags']
|
||||
.map((tag) => tagAliases[tag.toLowerCase()])
|
||||
.join(' ')
|
||||
.trim()
|
||||
if (tagString) tags[book.url] = tagString.replace(/\s+/g,' ')
|
||||
})
|
||||
}
|
||||
|
||||
return tags
|
||||
}
|
||||
|
||||
|
|
|
@ -27,11 +27,13 @@ export default {
|
|||
macos: '#macOS #Apple',
|
||||
mastodon: '#Mastodon',
|
||||
music: '#Music',
|
||||
nonfiction: '#NonFiction',
|
||||
privacy: '#Privacy',
|
||||
productivity: '#Productivity',
|
||||
react: '#JavaScript',
|
||||
rss: '#RSS',
|
||||
shoegaze: '#Shoegaze',
|
||||
scifi: '#SciFi',
|
||||
'social media': '#SocialMedia',
|
||||
spotify: '#Music',
|
||||
'surveillance capitalism': '#SurveillanceCapitalism',
|
||||
|
|
|
@ -63,7 +63,7 @@ export default {
|
|||
|
||||
tagLookup: (url, tagMap) => {
|
||||
if (!url) return
|
||||
if (url.includes('openlibrary.org')) return '#Books #NowReading'
|
||||
if (url.includes('openlibrary.org')) return `#Books #NowReading ${tagMap[url]}`
|
||||
if (url.includes('trakt.tv')) return '#Movies #Watching #Trakt'
|
||||
return tagMap[url] || ''
|
||||
},
|
||||
|
|
|
@ -12,6 +12,7 @@ export default async function () {
|
|||
url: `https://openlibrary.org/isbn/${book['isbn']}`,
|
||||
dateAdded: book?.['dateStarted'] || book?.['dateFinished'],
|
||||
status: book['status'],
|
||||
tags: book['tags'],
|
||||
type: 'book',
|
||||
}
|
||||
))
|
||||
|
|
Reference in a new issue