|
|
|
@ -25,12 +25,30 @@ router.get('/list/:filter?/:page?', function (req, res) {
|
|
|
|
|
for (let index = 0; index < pages.length; index++) {
|
|
|
|
|
let item = pages[index].metadata;
|
|
|
|
|
if (typeof item.deleted === 'undefined' || item.deleted === false) {
|
|
|
|
|
all.push(pages[index].metadata);
|
|
|
|
|
if (item.published == true) published.push(pages[index].metadata);
|
|
|
|
|
if (item.menu == true) menu.push(pages[index].metadata);
|
|
|
|
|
if (item.featured == true) featured.push(pages[index].metadata);
|
|
|
|
|
all.push({
|
|
|
|
|
page: pages[index].metadata,
|
|
|
|
|
date: moment(pages[index].metadata.created).fromNow()
|
|
|
|
|
});
|
|
|
|
|
if (item.published == true)
|
|
|
|
|
published.push({
|
|
|
|
|
page: pages[index].metadata,
|
|
|
|
|
date: moment(pages[index].metadata.created).fromNow()
|
|
|
|
|
});
|
|
|
|
|
if (item.menu == true)
|
|
|
|
|
menu.push({
|
|
|
|
|
page: pages[index].metadata,
|
|
|
|
|
date: moment(pages[index].metadata.created).fromNow()
|
|
|
|
|
});
|
|
|
|
|
if (item.featured == true)
|
|
|
|
|
featured.push({
|
|
|
|
|
page: pages[index].metadata,
|
|
|
|
|
date: moment(pages[index].metadata.created).fromNow()
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
deleted.push(pages[index].metadata);
|
|
|
|
|
deleted.push({
|
|
|
|
|
page: pages[index].metadata,
|
|
|
|
|
date: moment(pages[index].metadata.created).fromNow()
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var filtered;
|
|
|
|
@ -45,14 +63,17 @@ router.get('/list/:filter?/:page?', function (req, res) {
|
|
|
|
|
filtered = all;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
var count = Math.round(filtered.length / 6);
|
|
|
|
|
var count = Math.ceil(filtered.length / 6);
|
|
|
|
|
var pageItems = [];
|
|
|
|
|
var itemLimit = 6;
|
|
|
|
|
var rangeStart = pageNum * itemLimit - itemLimit;
|
|
|
|
|
for (var i = 0; i < itemLimit; i++) {
|
|
|
|
|
try {
|
|
|
|
|
if (filtered[i + rangeStart].id != null) {
|
|
|
|
|
pageItems.push(filtered[i + rangeStart]);
|
|
|
|
|
if (filtered[i + rangeStart].page.id != null) {
|
|
|
|
|
pageItems.push({
|
|
|
|
|
page: filtered[i + rangeStart].page,
|
|
|
|
|
date: moment(filtered[i + rangeStart].page.created).fromNow()
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
//console.log("NO POST", e)
|
|
|
|
|