More work on the archive. Start rendering conversations
This commit is contained in:
1 parent
493d1932f8
commit
db54ca40c6
7 files changed
+93
-5
No files matched your search
@@ -1,3 +1,4 @@
|
||||
module.exports = function(eleventyConfig) {
|
||||
eleventyConfig.addPlugin(require('./dates'));
|
||||
eleventyConfig.addPlugin(require('./notes'));
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
function conversationLength(note) {
|
||||
return note.replies.reduce((total, reply) => {
|
||||
return total + conversationLength(reply);
|
||||
}, 1);
|
||||
}
|
||||
|
||||
module.exports = function (eleventyConfig) {
|
||||
// Filter out notes so that it's only notes that aren't replying to a post
|
||||
eleventyConfig.addFilter('topLevelNotes', function (notes) {
|
||||
return notes.filter(note => !note.replyId);
|
||||
});
|
||||
|
||||
eleventyConfig.addFilter('conversationLength', conversationLength);
|
||||
}
|
||||
@@ -21,4 +21,5 @@ const markdownLib = markdownIt({
|
||||
|
||||
module.exports = function (eleventyConfig) {
|
||||
eleventyConfig.setLibrary('md', markdownLib);
|
||||
eleventyConfig.addFilter('md', content => content ? markdownLib.render(content) : "");
|
||||
}
|
||||
Reference in new issue
Block a user