|
|
|
@ -3,6 +3,7 @@ const express = require('express');
|
|
|
|
|
const router = express.Router();
|
|
|
|
|
const config = require('../../../site/settings.json');
|
|
|
|
|
const book = new Book();
|
|
|
|
|
const indexLimit = 5;
|
|
|
|
|
|
|
|
|
|
//--------------------------
|
|
|
|
|
// Index
|
|
|
|
@ -11,9 +12,12 @@ router.get('/', function (req, res) {
|
|
|
|
|
book.getPage().then(result => {
|
|
|
|
|
result.sort((a, b) => parseFloat(b.metadata.id) - parseFloat(a.metadata.id));
|
|
|
|
|
let indexPages = [];
|
|
|
|
|
let indexCount = 0;
|
|
|
|
|
result.forEach(page => {
|
|
|
|
|
if (typeof page.metadata.deleted === 'undefined' || page.metadata.deleted === false) {
|
|
|
|
|
if (indexCount === indexLimit) return;
|
|
|
|
|
indexPages.push(page);
|
|
|
|
|
++indexCount;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
let pageData = [];
|
|
|
|
|