diff options
author | terminaldweller <thabogre@gmail.com> | 2022-07-06 12:28:04 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2022-07-06 12:28:04 +0000 |
commit | 4302411fb080456ba5047a2b98700ae52a0fad29 (patch) | |
tree | b78706eb6983323a0ed3d56849388d1bba53dc21 /server.js | |
parent | a newer simpler template for the rss feed (diff) | |
download | blog-4302411fb080456ba5047a2b98700ae52a0fad29.tar.gz blog-4302411fb080456ba5047a2b98700ae52a0fad29.zip |
fixed rss validator errors except atom error
Diffstat (limited to '')
-rwxr-xr-x | server.js | 19 |
1 files changed, 10 insertions, 9 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) => { |