dynamically generate linux in ejs
This commit is contained in:
parent
59f866100a
commit
9ec9374ea2
20
app.js
20
app.js
@ -106,7 +106,7 @@ app.get('/', (req, res) => {
|
||||
const { blogPosts, totalPages } = getAllBlogPosts(page, postsPerPage, searchQuery);
|
||||
|
||||
res.render('index', {
|
||||
title: 'Raven Scott Blog',
|
||||
title: `${process.env.OWNER_NAME} Blog`,
|
||||
blogPosts,
|
||||
currentPage: page,
|
||||
totalPages,
|
||||
@ -116,12 +116,12 @@ app.get('/', (req, res) => {
|
||||
|
||||
// About Route
|
||||
app.get('/about', (req, res) => {
|
||||
res.render('about', { title: 'About Raven Scott' });
|
||||
res.render('about', { title: `About ${process.env.OWNER_NAME}` });
|
||||
});
|
||||
|
||||
// Display the Request a Quote form
|
||||
app.get('/contact', (req, res) => {
|
||||
res.render('contact', { title: 'Contact Raven Scott', msg: undefined });
|
||||
res.render('contact', { title: `Contact ${process.env.OWNER_NAME}`, msg: undefined });
|
||||
});
|
||||
|
||||
// Handle contact form submission
|
||||
@ -129,7 +129,7 @@ app.post('/contact', async (req, res) => {
|
||||
const { name, email, subject, message, 'g-recaptcha-response': captchaToken } = req.body;
|
||||
|
||||
if (!name || !email || !subject || !message) {
|
||||
return res.render('contact', { title: 'Contact Raven Scott', msg: 'All fields are required.' });
|
||||
return res.render('contact', { title: `Contact ${process.env.OWNER_NAME}`, msg: 'All fields are required.' });
|
||||
}
|
||||
|
||||
const captchaSecret = process.env.CAPTCHA_SECRET_KEY;
|
||||
@ -138,7 +138,7 @@ app.post('/contact', async (req, res) => {
|
||||
try {
|
||||
const captchaResponse = await axios.post(captchaVerifyUrl);
|
||||
if (!captchaResponse.data.success) {
|
||||
return res.render('contact', { title: 'Contact Raven Scott', msg: 'Captcha verification failed. Please try again.' });
|
||||
return res.render('contact', { title: `Contact ${process.env.OWNER_NAME}`, msg: 'Captcha verification failed. Please try again.' });
|
||||
}
|
||||
|
||||
const output = `
|
||||
@ -173,12 +173,12 @@ app.post('/contact', async (req, res) => {
|
||||
|
||||
transporter.sendMail(mailOptions, (error, info) => {
|
||||
if (error) {
|
||||
return res.render('contact', { title: 'Contact Raven Scott', msg: 'An error occurred. Please try again.' });
|
||||
return res.render('contact', { title: `Contact ${process.env.OWNER_NAME}`, msg: 'An error occurred. Please try again.' });
|
||||
}
|
||||
return res.render('contact', { title: 'Contact Raven Scott', msg: 'Your message has been sent successfully!' });
|
||||
return res.render('contact', { title: `Contact ${process.env.OWNER_NAME}`, msg: 'Your message has been sent successfully!' });
|
||||
});
|
||||
} catch (error) {
|
||||
return res.render('contact', { title: 'Contact Raven Scott', msg: 'An error occurred while verifying CAPTCHA. Please try again.' });
|
||||
return res.render('contact', { title: `Contact ${process.env.OWNER_NAME}`, msg: 'An error occurred while verifying CAPTCHA. Please try again.' });
|
||||
}
|
||||
});
|
||||
|
||||
@ -266,9 +266,9 @@ app.get('/rss', (req, res) => {
|
||||
});
|
||||
|
||||
let rssFeed = `<?xml version="1.0" encoding="UTF-8" ?>\n<rss version="2.0">\n<channel>\n`;
|
||||
rssFeed += `<title>Raven Scott Blog</title>\n`;
|
||||
rssFeed += `<title>${process.env.OWNER_NAME} Blog</title>\n`;
|
||||
rssFeed += `<link>https://${hostname}</link>\n`;
|
||||
rssFeed += `<description>This is the RSS feed for Raven Scott's blog.</description>\n`;
|
||||
rssFeed += `<description>This is the RSS feed for ${process.env.OWNER_NAME}'s blog.</description>\n`;
|
||||
|
||||
blogFiles.forEach(file => {
|
||||
const title = file.replace('.md', '');
|
||||
|
@ -5,13 +5,13 @@
|
||||
<!-- Meta and Title -->
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>About Me - Raven Scott</title>
|
||||
<title><%= title %> | <%= process.env.OWNER_NAME %> Blog</title>
|
||||
<!-- Bootstrap CSS -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
|
||||
<!-- Font Awesome CSS for Icons -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||
<!-- Custom CSS -->
|
||||
<link rel="stylesheet" href="https://raven-scott.fyi/css/styles.css">
|
||||
<link rel="stylesheet" href="<%= process.env.HOST_URL %>/css/styles.css">
|
||||
<style>
|
||||
/* Custom styles for a more professional look */
|
||||
body {
|
||||
@ -86,20 +86,20 @@
|
||||
<!-- Navigation Bar -->
|
||||
<nav class="navbar navbar-expand-lg navbar-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="https://raven-scott.fyi">raven-scott.fyi</a>
|
||||
<a class="navbar-brand" href="<%= process.env.HOST_URL %>">raven-scott.fyi</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="https://raven-scott.fyi">Home</a>
|
||||
<a class="nav-link active" href="<%= process.env.HOST_URL %>">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="https://raven-scott.fyi/about">About Me</a>
|
||||
<a class="nav-link" href="<%= process.env.HOST_URL %>/about">About Me</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="https://raven-scott.fyi/contact">Contact</a>
|
||||
<a class="nav-link" href="<%= process.env.HOST_URL %>/contact">Contact</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -137,8 +137,8 @@
|
||||
<a href="/" class="text-white text-decoration-none me-3">Home</a>
|
||||
<a href="/about" class="text-white text-decoration-none me-3">About</a>
|
||||
<a href="/contact" class="text-white text-decoration-none me-3">Contact</a>
|
||||
<a href="https://raven-scott.fyi/sitemap.xml" class="text-white text-decoration-none me-3">Sitemap</a>
|
||||
<a href="https://raven-scott.fyi/rss" class="text-white text-decoration-none">RSS Feed</a>
|
||||
<a href="<%= process.env.HOST_URL %>/sitemap.xml" class="text-white text-decoration-none me-3">Sitemap</a>
|
||||
<a href="<%= process.env.HOST_URL %>/rss" class="text-white text-decoration-none">RSS Feed</a>
|
||||
</p>
|
||||
<p class="mb-0">© 2024 Raven Scott. All rights reserved.</p>
|
||||
</div>
|
||||
|
@ -3,11 +3,11 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><%= title %></title>
|
||||
<title><%= title %> | <%= process.env.OWNER_NAME %> Blog</title>
|
||||
<!-- Stylesheets -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||
<link rel="stylesheet" href="https://raven-scott.fyi/css/styles.css">
|
||||
<link rel="stylesheet" href="<%= process.env.HOST_URL %>/css/styles.css">
|
||||
<!-- Highlight.js CSS for Syntax Highlighting -->
|
||||
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/default.min.css"> -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/atom-one-dark.min.css">
|
||||
@ -18,20 +18,20 @@
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-lg navbar-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="https://raven-scott.fyi">raven-scott.fyi</a>
|
||||
<a class="navbar-brand" href="<%= process.env.HOST_URL %>">raven-scott.fyi</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="https://raven-scott.fyi">Home</a>
|
||||
<a class="nav-link active" href="<%= process.env.HOST_URL %>">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="https://raven-scott.fyi/about">About Me</a>
|
||||
<a class="nav-link" href="<%= process.env.HOST_URL %>/about">About Me</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="https://raven-scott.fyi/contact">Contact</a>
|
||||
<a class="nav-link" href="<%= process.env.HOST_URL %>/contact">Contact</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -58,8 +58,8 @@
|
||||
<a href="/" class="text-white text-decoration-none me-3">Home</a>
|
||||
<a href="/about" class="text-white text-decoration-none me-3">About</a>
|
||||
<a href="/contact" class="text-white text-decoration-none me-3">Contact</a>
|
||||
<a href="https://raven-scott.fyi/sitemap.xml" class="text-white text-decoration-none me-3">Sitemap</a>
|
||||
<a href="https://raven-scott.fyi/rss" class="text-white text-decoration-none">RSS Feed</a>
|
||||
<a href="<%= process.env.HOST_URL %>/sitemap.xml" class="text-white text-decoration-none me-3">Sitemap</a>
|
||||
<a href="<%= process.env.HOST_URL %>/rss" class="text-white text-decoration-none">RSS Feed</a>
|
||||
</p>
|
||||
<p class="mb-0">© 2024 Raven Scott. All rights reserved.</p>
|
||||
</div>
|
||||
|
@ -5,13 +5,13 @@
|
||||
<!-- Meta and Title -->
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Contact Me - Raven Scott</title>
|
||||
<title>Contact Me - <%= process.env.OWNER_NAME %></title>
|
||||
<!-- Bootstrap CSS -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
|
||||
<!-- Font Awesome CSS for Icons -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||
<!-- Custom CSS -->
|
||||
<link rel="stylesheet" href="https://raven-scott.fyi/css/styles.css">
|
||||
<link rel="stylesheet" href="<%= process.env.HOST_URL %>/css/styles.css">
|
||||
<!-- reCAPTCHA API -->
|
||||
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
|
||||
</head>
|
||||
@ -21,20 +21,20 @@
|
||||
<!-- Navigation Bar -->
|
||||
<nav class="navbar navbar-expand-lg navbar-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="https://raven-scott.fyi">raven-scott.fyi</a>
|
||||
<a class="navbar-brand" href="<%= process.env.HOST_URL %>">raven-scott.fyi</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="https://raven-scott.fyi">Home</a>
|
||||
<a class="nav-link active" href="<%= process.env.HOST_URL %>">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="https://raven-scott.fyi/about">About Me</a>
|
||||
<a class="nav-link" href="<%= process.env.HOST_URL %>/about">About Me</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="https://raven-scott.fyi/contact">Contact</a>
|
||||
<a class="nav-link" href="<%= process.env.HOST_URL %>/contact">Contact</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -5,26 +5,26 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><%= title %></title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://raven-scott.fyi/css/styles.css">
|
||||
<link rel="stylesheet" href="<%= process.env.HOST_URL %>/css/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-lg navbar-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="https://raven-scott.fyi">raven-scott.fyi</a>
|
||||
<a class="navbar-brand" href="<%= process.env.HOST_URL %>">raven-scott.fyi</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="https://raven-scott.fyi">Home</a>
|
||||
<a class="nav-link active" href="<%= process.env.HOST_URL %>">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="https://raven-scott.fyi/about">About Me</a>
|
||||
<a class="nav-link" href="<%= process.env.HOST_URL %>/about">About Me</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="https://raven-scott.fyi/contact">Contact</a>
|
||||
<a class="nav-link" href="<%= process.env.HOST_URL %>/contact">Contact</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
<header class="py-5">
|
||||
<div class="container text-center">
|
||||
<h1>Hello, my name is Raven Scott</h1>
|
||||
<h1>Hello, my name is <%= process.env.OWNER_NAME %></h1>
|
||||
<p class="lead">Where Technology Meets Creativity: Insights from a Linux Enthusiast</p>
|
||||
<form action="/" method="get" class="mb-4">
|
||||
<div class="input-group">
|
||||
@ -100,8 +100,8 @@
|
||||
<a href="/" class="text-white text-decoration-none me-3">Home</a>
|
||||
<a href="/about" class="text-white text-decoration-none me-3">About</a>
|
||||
<a href="/contact" class="text-white text-decoration-none me-3">Contact</a>
|
||||
<a href="https://raven-scott.fyi/sitemap.xml" class="text-white text-decoration-none me-3">Sitemap</a>
|
||||
<a href="https://raven-scott.fyi/rss" class="text-white text-decoration-none">RSS Feed</a>
|
||||
<a href="<%= process.env.HOST_URL %>/sitemap.xml" class="text-white text-decoration-none me-3">Sitemap</a>
|
||||
<a href="<%= process.env.HOST_URL %>/rss" class="text-white text-decoration-none">RSS Feed</a>
|
||||
</p>
|
||||
<p class="mb-0">© 2024 Raven Scott. All rights reserved.</p>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user