From 0e39a2e40131fc484d2f80e0505acab1bbe8d7c9 Mon Sep 17 00:00:00 2001 From: Perception Date: Tue, 22 Dec 2020 16:54:57 -0800 Subject: [PATCH] Add routes and templates for archives --- routes/ad/:period.js | 3 +-- templates/ad-year-month.ejs | 4 ++-- templates/ad-year.ejs | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/routes/ad/:period.js b/routes/ad/:period.js index 31da856..f392a6e 100644 --- a/routes/ad/:period.js +++ b/routes/ad/:period.js @@ -3,7 +3,7 @@ const Database = require('better-sqlite3') const page = require('../../page') const ds = require('../../index') -const db = new Database('./main.db') +const db = ds.db() module.exports.GET = async (req, res) => { /* @@ -17,7 +17,6 @@ module.exports.GET = async (req, res) => { // year-month const [year, month] = period.split(/-/) const articles = await ds.getArticlesByYearMonth(db, year, month) - console.log(year, month, articles) const out = await page.render('ad-year-month', { year, month, articles }) send(res, 200, out) } else { diff --git a/templates/ad-year-month.ejs b/templates/ad-year-month.ejs index 2e11054..92a9ae3 100644 --- a/templates/ad-year-month.ejs +++ b/templates/ad-year-month.ejs @@ -7,8 +7,8 @@
-
-

<%- year %>

+
<% let last = '' %> diff --git a/templates/ad-year.ejs b/templates/ad-year.ejs index b112355..abdf408 100644 --- a/templates/ad-year.ejs +++ b/templates/ad-year.ejs @@ -4,7 +4,7 @@ –––––––––––––––––––––––––––––––––––––––––––––––––– --> <%- include('_search') %> -
+