added meta tag data to page render method, added page display limiter to dash index

This commit is contained in:
Ro 2020-05-28 16:13:52 -07:00
parent 7243e5ec32
commit c2517997c7
2 changed files with 6 additions and 1 deletions

View file

@ -65,7 +65,8 @@ export default class Render {
let file = pug.renderFile(template, { let file = pug.renderFile(template, {
title: page.metadata.title, title: page.metadata.title,
default_bg: page.metadata.feature, default_bg: page.metadata.feature,
content: html content: html,
tags: page.metadata.tags
}); });
fs.ensureDir(path).then(() => { fs.ensureDir(path).then(() => {

View file

@ -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 = [];