Add an about page. Move this to markdown. Move this to a pages service.
This commit is contained in:
parent
03f03ff471
commit
f41d77c93a
16
src/handlers/about.tsx
Normal file
16
src/handlers/about.tsx
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { Hono, Context } from 'hono';
|
||||||
|
|
||||||
|
const aboutPage = new Hono();
|
||||||
|
|
||||||
|
export async handleAboutPage(c: Context) {
|
||||||
|
const meta: SiteMeta = {
|
||||||
|
title: "About",
|
||||||
|
description: "About Dave Smith-Hayes - a dad, developer, musician.",
|
||||||
|
author: "Dave Smith-Hayes"
|
||||||
|
};
|
||||||
|
|
||||||
|
c.render(<AboutPage />, { meta });
|
||||||
|
}
|
||||||
|
|
||||||
|
aboutPage.get("/about", handleAboutPage);
|
||||||
|
export default aboutPage;
|
@ -1,6 +1,7 @@
|
|||||||
import { Style } from 'hono/css';
|
import { Style } from 'hono/css';
|
||||||
import { SiteMeta } from '@blog/models/SiteMeta';
|
import { SiteMeta } from '@blog/models/SiteMeta';
|
||||||
import { MetaTags } from '@blog/templates/components/MetaTags';
|
import { MetaTags } from '@blog/templates/components/MetaTags';
|
||||||
|
import { Navigation } from '@blog/templates/componennts/Navigation';
|
||||||
|
|
||||||
function getPageTitle(title: string|undefined): string {
|
function getPageTitle(title: string|undefined): string {
|
||||||
if (!title) {
|
if (!title) {
|
||||||
@ -25,6 +26,9 @@ export function Page({ children, meta }: { children: any, meta: SiteMeta }) {
|
|||||||
<a href="/">davesmithhayes.com</a>
|
<a href="/">davesmithhayes.com</a>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
<nav>
|
||||||
|
<Navigation />
|
||||||
|
</nav>
|
||||||
<main>
|
<main>
|
||||||
{children}
|
{children}
|
||||||
</main>
|
</main>
|
||||||
|
7
src/templates/Pages/AboutPage.tsx
Normal file
7
src/templates/Pages/AboutPage.tsx
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export function AboutPage() {
|
||||||
|
return (
|
||||||
|
<div class="main">
|
||||||
|
<p>Hello! I am Dave Smith-Hayes.</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
12
src/templates/components/Navigation.tsx
Normal file
12
src/templates/components/Navigation.tsx
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
const pages: Array<{ path: string, title: string }> = [
|
||||||
|
{ path: "/", title: "Home" },
|
||||||
|
{ path: "/about", title: "About" },
|
||||||
|
];
|
||||||
|
|
||||||
|
export function Navigation() {
|
||||||
|
return (
|
||||||
|
<ul>
|
||||||
|
{pages.map(p => <li><a href={p.path}>{p.title}</a></li> )}
|
||||||
|
</ul>
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user