move some things to .env

This commit is contained in:
Raven Scott 2024-09-26 01:05:37 -04:00
parent de3d09e1de
commit 1f64934d03

14
app.js
View File

@ -242,9 +242,9 @@ app.get('/sitemap.xml', (req, res) => {
// Static URLs (e.g., homepage, about, contact) // Static URLs (e.g., homepage, about, contact)
const staticUrls = [ const staticUrls = [
{ url: 'https://raven-scott.fyi/', changefreq: 'weekly', priority: 1.0 }, { url: `${process.env.HOST_URL}`, changefreq: 'weekly', priority: 1.0 },
{ url: 'https://raven-scott.fyi/about', changefreq: 'monthly', priority: 0.8 }, { url: `${process.env.HOST_URL}/about`, changefreq: 'monthly', priority: 0.8 },
{ url: 'https://raven-scott.fyi/contact', changefreq: 'monthly', priority: 0.8 } { url: `${process.env.HOST_URL}/contact`, changefreq: 'monthly', priority: 0.8 }
]; ];
// Dynamic URLs (e.g., blog posts) // 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'); const lastModifiedDate = format(new Date(stats.birthtime), 'yyyy-MM-dd');
return { return {
url: `https://blog.raven-scott.fyi/${slug}`, url: `${process.env.BLOG_URL}${slug}`,
lastmod: lastModifiedDate, lastmod: lastModifiedDate,
changefreq: 'monthly', changefreq: 'monthly',
priority: 0.9 priority: 0.9
@ -319,10 +319,10 @@ app.get('/rss', (req, res) => {
// RSS item for each post // RSS item for each post
rssFeed += `<item>\n`; rssFeed += `<item>\n`;
rssFeed += `<title>${title}</title>\n`; rssFeed += `<title>${title}</title>\n`;
rssFeed += `<link>https://blog.raven-scott.fyi/${slug}</link>\n`; rssFeed += `<link>${process.env.BLOG_URL}${slug}</link>\n`;
rssFeed += `<description>${lead || 'Read the full post on the blog.'}</description>\n`; rssFeed += `<description>${lead || 'Read the full post on the blog.'}</description>\n`;
rssFeed += `<pubDate>${lastModifiedDate}</pubDate>\n`; rssFeed += `<pubDate>${lastModifiedDate}</pubDate>\n`;
rssFeed += `<guid>https://blog.raven-scott.fyi/${slug}</guid>\n`; rssFeed += `<guid>${process.env.BLOG_URL}${slug}</guid>\n`;
rssFeed += `</item>\n`; rssFeed += `</item>\n`;
}); });
@ -337,7 +337,7 @@ app.get('/rss', (req, res) => {
app.use((req, res) => { app.use((req, res) => {
if (req.hostname === 'blog.raven-scott.fyi') { if (req.hostname === 'blog.raven-scott.fyi') {
// Redirect to the main domain // Redirect to the main domain
res.redirect('https://raven-scott.fyi'); res.redirect(process.env.HOST_URL);
} else { } else {
// Redirect to home page of the current domain // Redirect to home page of the current domain
res.redirect('/'); res.redirect('/');