fix: old syndication flow
This commit is contained in:
parent
87fd1f589e
commit
c2289e488d
18 changed files with 12825 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
|||
import { DateTime } from 'luxon'
|
||||
import { makeYearStats, processPostFile } from './utils.js'
|
||||
import tagAliases from '../data/tag-aliases.js'
|
||||
|
||||
export const searchIndex = (collection) => {
|
||||
const searchIndex = []
|
||||
|
@ -44,6 +45,23 @@ export const tagList = (collection) => {
|
|||
return Array.from(tagsSet).sort()
|
||||
}
|
||||
|
||||
export const tagMap = (collection) => {
|
||||
const tags = {}
|
||||
const collectionData = collection.getAll()[0]
|
||||
const posts = collectionData.data.collections.posts
|
||||
const links = collectionData.data.links
|
||||
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()]))]
|
||||
.join(' ')
|
||||
.trim()
|
||||
if (tagString) tags[url] = tagString.replace(/\s+/g,' ')
|
||||
})
|
||||
}
|
||||
return tags
|
||||
}
|
||||
|
||||
export const tagsSortedByCount = (collection) => {
|
||||
const tagStats = {};
|
||||
collection.getFilteredByGlob('src/posts/**/*.*').forEach((item) => {
|
||||
|
|
42
config/data/tag-aliases.js
Normal file
42
config/data/tag-aliases.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
export default {
|
||||
'11ty': '#Eleventy',
|
||||
accessibility: '#Accessibility',
|
||||
ai: '#AI',
|
||||
'black metal': '#BlackMetal',
|
||||
blogging: '#Blogging',
|
||||
books: '#Books',
|
||||
climate: '#Climate',
|
||||
css: '#CSS',
|
||||
'death metal': '#DeathMetal',
|
||||
development: '#WebDev',
|
||||
economics: '#Economics',
|
||||
eleventy: '#Eleventy',
|
||||
email: '#Email',
|
||||
emo: '#Emo',
|
||||
fastmail: '#Email',
|
||||
gmail: '#Email',
|
||||
grindcore: '#Grindcore',
|
||||
health: '#Health',
|
||||
'indie web': '#IndieWeb #SmallWeb',
|
||||
ios: '#iOS #Apple',
|
||||
javascript: '#JavaScript',
|
||||
'last.fm': '#Music',
|
||||
journalism: '#Journalism',
|
||||
labor: '#Work',
|
||||
lastfm: '#Music',
|
||||
macos: '#macOS #Apple',
|
||||
mastodon: '#Mastodon',
|
||||
music: '#Music',
|
||||
privacy: '#Privacy',
|
||||
productivity: '#Productivity',
|
||||
react: '#JavaScript',
|
||||
rss: '#RSS',
|
||||
shoegaze: '#Shoegaze',
|
||||
'social media': '#SocialMedia',
|
||||
spotify: '#Music',
|
||||
'surveillance capitalism': '#SurveillanceCapitalism',
|
||||
'tattoos': '#Tattoos',
|
||||
tech: '#Tech',
|
||||
technology: '#Tech',
|
||||
'web components': '#WebComponents'
|
||||
}
|
|
@ -60,6 +60,13 @@ export default {
|
|||
return visitors(b) - visitors(a)
|
||||
})
|
||||
},
|
||||
|
||||
tagLookup: (url, tagMap) => {
|
||||
if (!url) return
|
||||
if (url.includes('openlibrary.org')) return '#Books #NowReading'
|
||||
if (url.includes('trakt.tv')) return '#Movies #Watching #Trakt'
|
||||
return tagMap[url] || ''
|
||||
},
|
||||
|
||||
// authors
|
||||
authorLookup: (url) => {
|
||||
|
|
Reference in a new issue