diff --git a/config/filters/index.js b/config/filters/index.js index 593022a3..00215c08 100644 --- a/config/filters/index.js +++ b/config/filters/index.js @@ -80,42 +80,54 @@ export default { // feeds normalizeEntries: (entries) => { const posts = [] - entries.forEach((entry) => { - const dateKey = Object.keys(entry).find((key) => key.includes('date')) - const date = new Date(entry[dateKey]) + const mdGenerator = () => { const md = markdownIt({ html: true, linkify: true }) + + md.use(markdownItAnchor, { + level: [1, 2], + permalink: markdownItAnchor.permalink.headerLink({ + safariReaderFix: true + }) + }) + md.use(markdownItFootnote) + md.renderer.rules.footnote_ref = (tokens, idx) => { + const id = tokens[idx].meta.id + 1 + return `${id}` + } + md.renderer.rules.footnote_block_open = () => ( + '
This is a full text feed, but not all content can be rendered perfectly within the feed. If something looks off, feel free to visit my site for the original post.
' - md.use(markdownItAnchor, { - level: [1, 2], - permalink: markdownItAnchor.permalink.headerLink({ - safariReaderFix: true, - }), - }) - md.use(markdownItFootnote) - - // set the entry url if (entry.url?.includes('http')) url = entry.url if (!entry.url?.includes('http')) url = new URL(entry.url, BASE_URL).toString() - if (entry?.slug) url = new URL(entry.slug, BASE_URL).toString() + if (entry?.slug) url = new URL(entry.slug, BASE_URL).toString() if (entry?.link) { title = `${entry.title} via ${entry.authors.name}` url = entry.link } - - // set the entry excerpt - if (entry.description) excerpt = entry.description // general case - if (entry.type === 'book' || entry.type === 'movie' || entry.type === 'link') excerpt = `${entry.description}