diff --git a/src/model/SiteMeta.ts b/src/model/SiteMeta.ts index 1228754..2765927 100644 --- a/src/model/SiteMeta.ts +++ b/src/model/SiteMeta.ts @@ -1,5 +1,5 @@ export type SiteMeta = { - description: string, - tags: string[], + description?: string, + tags?: string[], author?: string, }; diff --git a/src/routes/posts.tsx b/src/routes/posts.tsx index c69c8b0..33c2c5a 100644 --- a/src/routes/posts.tsx +++ b/src/routes/posts.tsx @@ -1,9 +1,9 @@ import { Hono } from 'hono'; - import { PostPage } from '@blog/templates/Pages/PostPage'; import { FourOhFour } from '@blog/templates/Pages/FourOhFour'; import { readdir } from 'node:fs/promises'; -import { readPostMarkdown } from '@blog/util/readPostMarkdown'; +import { SiteMeta } from '@blog/model/SiteMeta'; +import { readPostMarkdown } from '@blog/util/post-reader'; const app = new Hono(); @@ -18,8 +18,14 @@ app.get('/posts/:slug', async (c) => { return c.render(); } - const post = await readPostMarkdown(__dirname + "/../posts/" + postFile); - return c.render(); + const post = await readPostMarkdown(postFile); + const meta = { + description: post.meta.description, + tags: post.meta.tags, + author: "Dave Smith-Hayes" + }; + + return c.render(, { meta }); }); export default app; diff --git a/src/templates/Page.tsx b/src/templates/Page.tsx index ffb0404..162d796 100644 --- a/src/templates/Page.tsx +++ b/src/templates/Page.tsx @@ -1,5 +1,6 @@ import { css, Style } from 'hono/css'; import { SiteMeta } from '@blog/model/SiteMeta'; +import { MetaTags } from '@blog/templates/components/MetaTags'; const logoClass = css` font-size: 16pt; @@ -10,6 +11,7 @@ export function Page({ children, meta }: { children: any, meta: SiteMeta }) { davesmithhayes.com +