diff --git a/helpers/markdown.js b/helpers/markdown.js index 76d7533b..e73558af 100644 --- a/helpers/markdown.js +++ b/helpers/markdown.js @@ -14,7 +14,7 @@ module.exports = (board, thread, text) => { const quote = lines[j].match(quoteRegex); if (quote) { const quotenum = quote[0].substring(2); - lines[j] = lines[j].replace(quote[0], `>>${quotenum}`); + lines[j] = lines[j].replace(quote[0], `>>${quotenum}`); continue; } //replace greentexts diff --git a/models/frontend/board.js b/models/frontend/board.js index 68ae46ce..be8a8226 100644 --- a/models/frontend/board.js +++ b/models/frontend/board.js @@ -5,8 +5,10 @@ const Posts = require(__dirname+'/../../db-models/posts.js'); module.exports = async (req, res) => { //get the recently bumped thread & preview posts let threads; + let pages; try { - threads = await Posts.getRecent(req.params.board, req.params.page); + threads = await Posts.getRecent(req.params.board, req.params.page || 1); + pages = Math.ceil((await Posts.getPages(req.params.board)) / 10); } catch (err) { return next(err); } @@ -14,6 +16,7 @@ module.exports = async (req, res) => { //render the page res.render('board', { csrf: req.csrfToken(), - threads: threads || [] + threads: threads || [], + pages: pages }); }