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