Add the site meta to the 404 page when looking for posts.

This commit is contained in:
Dave Smith-Hayes 2024-07-03 22:19:37 -04:00
parent ac6dbb0fb4
commit d49cf2cc98

View File

@ -15,11 +15,14 @@ app.get('/:slug', async (c) => {
const postFile = files.find(f => f === fileName); const postFile = files.find(f => f === fileName);
if (!postFile) { if (!postFile) {
c.status(404); c.status(404);
return c.render(<FourOhFour />); const meta: SiteMeta = {
description: "Page does not exist."
};
return c.render(<FourOhFour />, { meta });
} }
const post = await readPostMarkdown(__dirname + "/../../posts/" + postFile); const post = await readPostMarkdown(__dirname + "/../../posts/" + postFile);
const meta = { const meta: SiteMeta = {
description: post.meta.description, description: post.meta.description,
tags: post.meta.tags, tags: post.meta.tags,
author: "Dave Smith-Hayes" author: "Dave Smith-Hayes"