aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2022-07-06 12:28:04 +0000
committerterminaldweller <thabogre@gmail.com>2022-07-06 12:28:04 +0000
commit4302411fb080456ba5047a2b98700ae52a0fad29 (patch)
treeb78706eb6983323a0ed3d56849388d1bba53dc21
parenta newer simpler template for the rss feed (diff)
downloadblog-4302411fb080456ba5047a2b98700ae52a0fad29.tar.gz
blog-4302411fb080456ba5047a2b98700ae52a0fad29.zip
fixed rss validator errors except atom error
-rwxr-xr-xserver.js19
-rw-r--r--views/rss_feed_v2.pug2
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