More work on the archive. Start rendering conversations

This commit is contained in:
Lewis Dale committed 2024-01-05 13:36:37 +00:00
1 parent 493d1932f8
commit db54ca40c6
7 files changed
+93 -5

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(require('./dates'));
eleventyConfig.addPlugin(require('./notes'));
}
+14
View File
@@ -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);
}