aboutsummaryrefslogtreecommitdiffstats
path: root/server.js
diff options
context:
space:
mode:
authorterminaldweller <devi@terminaldweller.com>2024-03-15 19:48:13 +0000
committerterminaldweller <devi@terminaldweller.com>2024-03-15 19:48:13 +0000
commit86f26aefb312cd24a08c9c773c96c50da429bb43 (patch)
tree2fa4a305fd42052759da4a18202e51f69f47a95b /server.js
parentadded a new script to conevrt all md to asciidoc, rss feed now sends the enti... (diff)
downloadblog-86f26aefb312cd24a08c9c773c96c50da429bb43.tar.gz
blog-86f26aefb312cd24a08c9c773c96c50da429bb43.zip
tag grouppings, WIP
Diffstat (limited to 'server.js')
-rwxr-xr-xserver.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/server.js b/server.js
index 49b107f..6871564 100755
--- a/server.js
+++ b/server.js
@@ -99,6 +99,23 @@ function renderAndSend_v2(req, res, slug) {
});
}
+function renderTagPage(req, res, tag) {
+ model.blogPost
+ .find(
+ { keywords: { $in: [tag] } },
+ { projection: { _id: 0, title: 0, teaser: 0, body: 0, keywords: 0 } },
+ )
+ .exec(function (err, blogPosts) {
+ if (err) return err;
+ return res.render("tags.ejs", {
+ cache: true,
+ data: {
+ blogPosts: blogPosts,
+ },
+ });
+ });
+}
+
app.get("/health", (req, res) => {
res.type("application/json");
let response = { isOK: "True", error: "" };
@@ -153,6 +170,13 @@ app.get("/posts/:postName", (req, res) => {
renderAndSend_v2(req, res, req.params.postName);
});
+app.get("/tags/:tagName", (req, res) => {
+ if (req.params["tagName"] == "") {
+ res.write("nothing requested!");
+ }
+ renderTagPage(req, res, req.params.tagName);
+});
+
app.get("/$", (req, res) => {
model.blogPost
.find({}, { projection: { _id: 0, title: 0, teaser: 0 } })