mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-12 05:31:41 +00:00
Feature/rss feed (#192)
* installed @11ty/eleventy-plugin-rss package and added it to the config * adding default rss template from the 11ty documentation * using 'definedWords' as a collection, not 'posts' * added a link to the feed in the html head, on the homepage so it's co-located with the other means of engagement, and in the feed itself (permalink is now part of metadata too) * metadata.description is what we want to show as the feed subtitle, and made the author name safe as part of the metadata json; can't use the safe filter otherwise xml blows up * removed redundant --- from right below the frontmatter, which md turns into a <hr>, which makes xml blow up * made indentation consistent * removing subscribe link from the CTA box, adding it to the footer next to Documentation link with bullet delimiter; updated site footer's ul style to show list items as display-block elements * on definition pages, the footer is constrained to have the max width of the sidebar (160px). set grid-column: 1 / -1 to give it the full width to match the home/toc page * created a new collection for sorting only defined words via their .date value (should be created date unless otherwise specified) * RSS feed now shows posts in the order used by new definedWordsChronological collection * reversed sort order as requested * re-prettier-ifying eleventy.js Co-authored-by: Oscar <ovlb@users.noreply.github.com>
This commit is contained in:
14
.eleventy.js
14
.eleventy.js
@ -1,6 +1,7 @@
|
||||
const definitionPermalink = require('./11ty/helpers/definitionPermalink');
|
||||
const renderDefinitionContentNextEntries = require('./11ty/shortcodes/renderDefinitionContentNextEntries');
|
||||
const findExistingDefinition = require('./11ty/filters/helpers/findExistingDefinition');
|
||||
const pluginRss = require('@11ty/eleventy-plugin-rss');
|
||||
|
||||
module.exports = function(config) {
|
||||
// Add a filter using the Config API
|
||||
@ -38,6 +39,8 @@ module.exports = function(config) {
|
||||
console.log(post);
|
||||
});
|
||||
|
||||
config.addPlugin(pluginRss);
|
||||
|
||||
config.addShortcode('definitionFlag', (flag) => {
|
||||
const cleanText = new Map([
|
||||
[
|
||||
@ -169,6 +172,17 @@ module.exports = function(config) {
|
||||
});
|
||||
});
|
||||
|
||||
config.addCollection('definedWordsChronological', (collection) => {
|
||||
return collection
|
||||
.getFilteredByGlob('./11ty/definitions/*.md')
|
||||
.filter((word) => word.data.defined)
|
||||
.sort((a, b) => {
|
||||
if (a.date > b.date) return -1;
|
||||
if (a.date < b.date) return 1;
|
||||
return 0;
|
||||
});
|
||||
});
|
||||
|
||||
const mdIt = require('markdown-it')({
|
||||
html: true
|
||||
});
|
||||
|
Reference in New Issue
Block a user