Add meta
This commit is contained in:
parent
474e08516d
commit
381cd6bac2
7
app.js
7
app.js
@ -215,10 +215,14 @@ app.get('/blog/:slug', (req, res) => {
|
|||||||
const blogPosts = getAllBlogPosts();
|
const blogPosts = getAllBlogPosts();
|
||||||
const { contentHtml, lead } = loadMarkdownWithLead(markdownFile);
|
const { contentHtml, lead } = loadMarkdownWithLead(markdownFile);
|
||||||
|
|
||||||
|
// Fallback to a generic description if lead is not available
|
||||||
|
const description = lead || `${originalTitle} - Read the full post on ${process.env.OWNER_NAME}'s blog.`;
|
||||||
|
|
||||||
res.render('blog-post', {
|
res.render('blog-post', {
|
||||||
title: originalTitle,
|
title: originalTitle,
|
||||||
content: contentHtml,
|
content: contentHtml,
|
||||||
lead: lead,
|
lead,
|
||||||
|
description, // Pass the description to the view
|
||||||
blogPosts
|
blogPosts
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -226,6 +230,7 @@ app.get('/blog/:slug', (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Sitemap Route
|
// Sitemap Route
|
||||||
app.get('/sitemap.xml', (req, res) => {
|
app.get('/sitemap.xml', (req, res) => {
|
||||||
const hostname = req.headers.host || 'http://localhost';
|
const hostname = req.headers.host || 'http://localhost';
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<!-- Meta and Title -->
|
<!-- Meta and Title -->
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="description" content="<%= process.env.OWNER_NAME %>'s Blog">
|
||||||
<title><%= title %> | <%= process.env.OWNER_NAME %>'s' Blog</title>
|
<title><%= title %> | <%= process.env.OWNER_NAME %>'s' Blog</title>
|
||||||
<!-- Bootstrap CSS -->
|
<!-- Bootstrap CSS -->
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="description" content="<%= description %>">
|
||||||
<title><%= title %> | <%= process.env.OWNER_NAME %>'s Blog</title>
|
<title><%= title %> | <%= process.env.OWNER_NAME %>'s Blog</title>
|
||||||
<!-- Stylesheets -->
|
<!-- 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://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
<!-- Meta and Title -->
|
<!-- Meta and Title -->
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="description" content="Contact <%= process.env.OWNER_NAME % using a contact form">
|
||||||
|
|
||||||
<title>Contact Me - <%= process.env.OWNER_NAME %></title>
|
<title>Contact Me - <%= process.env.OWNER_NAME %></title>
|
||||||
<!-- Bootstrap CSS -->
|
<!-- Bootstrap CSS -->
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="description" content="<%= process.env.OWNER_NAME %>'s Blog">
|
||||||
<title><%= title %></title>
|
<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://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="<%= process.env.HOST_URL %>/css/styles.css">
|
<link rel="stylesheet" href="<%= process.env.HOST_URL %>/css/styles.css">
|
||||||
|
Loading…
Reference in New Issue
Block a user