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