From ef9665f12b7ca71d0ddbfe0e6d9326ffb2831dc7 Mon Sep 17 00:00:00 2001 From: Ro Date: Thu, 2 Jul 2020 14:06:57 -0700 Subject: [PATCH] removed comment --- brain/data/Render.js | 16 +++++++++++++++- site/init/settings-template.json | 4 +++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/brain/data/Render.js b/brain/data/Render.js index aa2ff73..00278da 100644 --- a/brain/data/Render.js +++ b/brain/data/Render.js @@ -34,11 +34,24 @@ export default class Render { return page.metadata.deleted === false && page.metadata.published === true; }).length; let rendered = 0; + let display_count = 0; + let recent = []; for (let index = 0; index < pages.length; index++) { + pages.sort((a, b) => parseFloat(b.metadata.id) - parseFloat(a.metadata.id)); + const page = pages[index]; if (page.metadata.deleted === false && page.metadata.published === true) { + if (recent.length < config.global.display_limit) { + recent.push({ + title: page.metadata.title, + slug: page.metadata.slug, + feature: page.metadata.feature, + created: moment(page.metadata.created).fromNow(), + path: page.metadata.path + }); + display_count = ++display_count; + } let writeFile, template; - //create case for index path let path = 'public/' + moment(page.metadata.created).format('YYYY') + @@ -85,6 +98,7 @@ export default class Render { content: html, tags: tags, menu: config.menu, + recent_posts: recent, meta: { who: author, when: moment(page.metadata.created).fromNow(), diff --git a/site/init/settings-template.json b/site/init/settings-template.json index 9d5e75f..af7afdb 100644 --- a/site/init/settings-template.json +++ b/site/init/settings-template.json @@ -6,7 +6,9 @@ "background": "/assets/images/global/default-bg.jpg", "private": "true", "renderOnSave": "false", - "theme": "default-light" + "theme": "default-light", + "display_limit": 5, + "last_backup": null }, "library_stats": { "current_index": 1