diff options
-rwxr-xr-x | server.js | 19 | ||||
-rw-r--r-- | views/rss_feed_v2.pug | 2 |
2 files changed, 11 insertions, 10 deletions
@@ -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 |