From d5f2c72acd877acbb3683b50cfbbe9f3c0d98af3 Mon Sep 17 00:00:00 2001 From: Gitea Date: Sat, 13 Mar 2021 14:34:54 -0600 Subject: Add meta description and sitemap --- src/server.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/server.js') diff --git a/src/server.js b/src/server.js index 58d29fb..c770304 100644 --- a/src/server.js +++ b/src/server.js @@ -147,9 +147,6 @@ function setUpRoutes(models, jwtFunctions, database, templates) { let body = templates["blog-single"]({posts, date}); res.status(200).send(body) }) -<<<<<<< HEAD - server.get('/tags/:name', cache('5 minutes'), async (req, res) => { -======= server.get('/post/like/:type/:id', async (req, res) => { let type = req.params.type let id = req.params.id @@ -159,8 +156,7 @@ function setUpRoutes(models, jwtFunctions, database, templates) { post.update({likes: post.likes+1}) res.status(200).send({likes: post.likes}); }) - server.get('/tags/:name', async (req, res) => { ->>>>>>> 5b5dc610bc0da17fd006982de50b4dc74b134a54 + server.get('/tags/:name', cache('5 minutes'), async (req, res) => { const { name } = req.params; const postsWithTag = await models.tags.findAll({ attributes: ["postId"], where: { text: name } }) .map(function (x) { @@ -179,6 +175,8 @@ function setUpRoutes(models, jwtFunctions, database, templates) { res.status(200).send(body) }) + server.get('/sitemap.xml', cache('5 minutes'), (req, res) => res.sendFile(__dirname + "/misc/sitemap.xml")); + server.get('/robots.txt', cache('5 minutes'), (req, res) => res.sendFile(__dirname + "/misc/robots.txt")); server.get('/admin', cache('5 minutes'), (req, res) => res.sendFile(__dirname + "/html/admin.html")); server.get('/login', cache('5 minutes'), (req, res) => res.sendFile(__dirname + "/html/login.html")) server.get('/email', cache('5 minutes'), (req, res) => res.sendFile(__dirname + "/html/email.html")) -- cgit v1.2.3