From 1f64934d03ad2b36fa8e50bce4ed23137ecfa722 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Thu, 26 Sep 2024 01:05:37 -0400 Subject: [PATCH] move some things to .env --- app.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app.js b/app.js index 0c25ab6..c90ef77 100644 --- a/app.js +++ b/app.js @@ -242,9 +242,9 @@ app.get('/sitemap.xml', (req, res) => { // Static URLs (e.g., homepage, about, contact) const staticUrls = [ - { url: 'https://raven-scott.fyi/', changefreq: 'weekly', priority: 1.0 }, - { url: 'https://raven-scott.fyi/about', changefreq: 'monthly', priority: 0.8 }, - { url: 'https://raven-scott.fyi/contact', changefreq: 'monthly', priority: 0.8 } + { url: `${process.env.HOST_URL}`, changefreq: 'weekly', priority: 1.0 }, + { url: `${process.env.HOST_URL}/about`, changefreq: 'monthly', priority: 0.8 }, + { url: `${process.env.HOST_URL}/contact`, changefreq: 'monthly', priority: 0.8 } ]; // Dynamic URLs (e.g., blog posts) @@ -257,7 +257,7 @@ app.get('/sitemap.xml', (req, res) => { const lastModifiedDate = format(new Date(stats.birthtime), 'yyyy-MM-dd'); return { - url: `https://blog.raven-scott.fyi/${slug}`, + url: `${process.env.BLOG_URL}${slug}`, lastmod: lastModifiedDate, changefreq: 'monthly', priority: 0.9 @@ -319,10 +319,10 @@ app.get('/rss', (req, res) => { // RSS item for each post rssFeed += `\n`; rssFeed += `${title}\n`; - rssFeed += `https://blog.raven-scott.fyi/${slug}\n`; + rssFeed += `${process.env.BLOG_URL}${slug}\n`; rssFeed += `${lead || 'Read the full post on the blog.'}\n`; rssFeed += `${lastModifiedDate}\n`; - rssFeed += `https://blog.raven-scott.fyi/${slug}\n`; + rssFeed += `${process.env.BLOG_URL}${slug}\n`; rssFeed += `\n`; }); @@ -337,7 +337,7 @@ app.get('/rss', (req, res) => { app.use((req, res) => { if (req.hostname === 'blog.raven-scott.fyi') { // Redirect to the main domain - res.redirect('https://raven-scott.fyi'); + res.redirect(process.env.HOST_URL); } else { // Redirect to home page of the current domain res.redirect('/');