Welcome to My Blog
-This is a sample blog post written in Markdown.
-Features
--
-
- Easy to write -
- Converts to clean HTML -
- Supports bold, italic, and
inline code
-
Code Example
-console.log("Hello, world!");
-
-
-diff --git a/public/css/styles.css b/public/css/styles.css index 2502362..2721fd1 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -20,6 +20,22 @@ margin: 0 auto; padding: 1rem 1.5rem; } +/* +nav { + width: 200px; + float: left; + background: #222; + color: #eee; + height: 100vh; + padding: 1rem; + box-sizing: border-box; +}*/ + +/* Content area */ +main { + margin-left: 200px; + padding: 1rem; +} /* Header */ header { @@ -85,11 +101,6 @@ font-size: 0.95rem; box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05); } -/* .sidebar nav .menu-year { - font-weight: bold; - margin-bottom: 1rem; - font-size: 1.1rem; -} */ .sidebar .menu-year { font-weight: 700; font-size: 1.2rem; @@ -169,3 +180,39 @@ margin: 0; } } +/* Small screen adjustments */ + +@media (max-width: 600px) { + nav { + width: 100%; + height: auto; + float: none; + padding: 0.5rem; + text-align: center; + border-bottom: 1px solid #444; + background: #111; + } + main { + margin-left: 0; + padding: 1rem 0.5rem; + } + nav ul { + display: block; + justify-content: center; + flex-wrap: wrap; + gap: 1rem; + padding: 0.5rem 0; + margin: 0; + list-style: none; + } + nav ul li { + margin: 0.25rem 0; + border: none; + /* display: inline-block; */ + } + nav ul li a { + padding: 0.5rem 1rem; + display: block; + border-radius: 0; + } +} diff --git a/src/middleware/formatHtml.js b/src/middleware/formatHtml.js index 2510eda..345367e 100644 --- a/src/middleware/formatHtml.js +++ b/src/middleware/formatHtml.js @@ -4,19 +4,19 @@ module.exports = function (req, res, next) { const originalSend = res.send; - // res.send = function (body) { - // if ( - // typeof body === "string" && - // res.get("Content-Type")?.includes("text/html") - // ) { - // body = beautify(body, { - // indent_size: 2, - // wrap_line_length: 80, - // end_with_newline: true, - // }); - // } - // return originalSend.call(this, body); - // }; + res.send = function (body) { + if ( + typeof body === "string" && + res.get("Content-Type")?.includes("text/html") + ) { + body = beautify(body, { + indent_size: 2, + wrap_line_length: 80, + end_with_newline: true, + }); + } + return originalSend.call(this, body); + }; next(); }; diff --git a/src/routes/about.js b/src/routes/about.js new file mode 100644 index 0000000..a1acd7f --- /dev/null +++ b/src/routes/about.js @@ -0,0 +1,13 @@ +// src/routes/about.js +const express = require("express"); +const router = express.Router(); +const getBaseContext = require("../utils/baseContext"); + +router.get("/about", async (req, res) => { + const context = await getBaseContext({ + title: "About", + }); + res.render("pages/about.handlebars", context); +}); + +module.exports = router; diff --git a/src/routes/index.js b/src/routes/index.js index f605b8c..828573e 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -6,10 +6,12 @@ const path = require("path"); const matter = require("gray-matter"); const contact = require("./contact"); +const about = require("./about"); const getBaseContext = require("../utils/baseContext"); router.use(contact); +router.use(about); router.get("/post/:year/:month/:name", async (req, res, next) => { const { year, month, name } = req.params; diff --git a/src/views/pages/about.handlebars b/src/views/pages/about.handlebars new file mode 100644 index 0000000..2d09e78 --- /dev/null +++ b/src/views/pages/about.handlebars @@ -0,0 +1,3 @@ + +
This blog is maintained by Jason Poage. It covers programming, technology, and related topics.
diff --git a/static/404.html b/static/404.html deleted file mode 100644 index 166c358..0000000 --- a/static/404.html +++ /dev/null @@ -1,3 +0,0 @@ -The requested blog post could not be found.
- diff --git a/static/index.html b/static/index.html deleted file mode 100644 index 7265c6c..0000000 --- a/static/index.html +++ /dev/null @@ -1,6 +0,0 @@ -Welcome to the blog.
-This is a sample blog post written in Markdown.
-inline codeconsole.log("Hello, world!");
-
-
-