From 4302411fb080456ba5047a2b98700ae52a0fad29 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Wed, 6 Jul 2022 16:58:04 +0430 Subject: fixed rss validator errors except atom error --- server.js | 19 ++++++++++--------- views/rss_feed_v2.pug | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/server.js b/server.js index 286932d..b609018 100755 --- a/server.js +++ b/server.js @@ -74,10 +74,10 @@ async function enumerateDir() { return await fs.readdirSync(path.join(__dirname, "mds")); } -function renderAndSend_v2(req, res) { +function renderAndSend_v2(req, res, slug) { model.blogPost .findOne( - { _slug: req.path }, + { slug: slug }, { projection: { _id: 0, @@ -135,6 +135,7 @@ app.get("/robots.txt", (req, res) => { }); app.get("/rss/feed", (req, res) => { + res.type("application/rss+xml"); model.blogPost .find({}) .sort("-lastUpdatedAt") @@ -145,6 +146,13 @@ app.get("/rss/feed", (req, res) => { }); }); +app.get("/posts/:postName", (req, res) => { + if (req.params["postName"] == "") { + res.write("nothing requested!"); + } + renderAndSend_v2(req, res, req.params.postName); +}); + app.get("/$", (req, res) => { model.blogPost .find({}, { projection: { _id: 0, title: 0, teaser: 0 } }) @@ -163,13 +171,6 @@ app.get("/$", (req, res) => { }); }); -app.get("/posts/:postName", (req, res) => { - if (req.params["postName"] == "") { - res.write("nothing requested!"); - } - renderAndSend_v2(req, res); -}); - app.use(sitemap(enumerateDir, "https://blog.terminaldweller.com")); app.use((req, res) => { diff --git a/views/rss_feed_v2.pug b/views/rss_feed_v2.pug index 92c9a87..b680cb9 100644 --- a/views/rss_feed_v2.pug +++ b/views/rss_feed_v2.pug @@ -4,7 +4,7 @@ rss(version='2.0') title deviblog link https://blog.terminaldweller.com description I talk about software here. - managingEditro devi@terminaldweller.com + managingEditor devi@terminaldweller.com webMaster devi@terminaldweller.com language en-US if posts.length -- cgit v1.2.3