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) => {
|
||||
|
|
Reference in a new issue