chore: add name to page titles

This commit is contained in:
Oliver Davies 2023-10-04 01:09:39 +01:00
parent 280db0d969
commit 25dcd4dd37
3 changed files with 6 additions and 3 deletions

View file

@ -5,6 +5,7 @@ import Banner from "../components/Banner.astro";
import Navbar from "../components/Navbar.astro";
export interface Props {
isFront: boolean;
title: string;
}
@ -39,6 +40,7 @@ const footerLinks = [
];
const canonicalURL = new URL(Astro.url.pathname, Astro.site).toString().replace(/\/$/, "");
const isFrontPage = Astro.props.isFront;
---
<!DOCTYPE html>
@ -54,7 +56,7 @@ const canonicalURL = new URL(Astro.url.pathname, Astro.site).toString().replace(
rel="stylesheet"
/>
<link rel="canonical" href={canonicalURL} />
<title>{title}</title>
<title>{isFrontPage ? title : `${title} | Oliver Davies`}</title>
<script
defer
data-domain="oliverdavies.uk"

View file

@ -2,10 +2,10 @@
import BaseLayout from "./Layout.astro";
import Markdown from "~/components/Markdown.astro";
const { title } = Astro.props.frontmatter || Astro.props;
const { isFront, title } = Astro.props.frontmatter || Astro.props;
---
<BaseLayout title={title}>
<BaseLayout isFront={isFront || false} title={title}>
<Markdown>
<slot />
</Markdown>

View file

@ -1,6 +1,7 @@
---
layout: ~/layouts/PageLayout.astro
title: Oliver Davies - Software Developer and Drupal Expert
isFront: true
---
import { numberOfYears } from '~/utils';