Add header/metadata fields

This commit is contained in:
2025-11-19 11:48:29 +13:00
parent 1da77d6074
commit 32b9a29028
6 changed files with 22 additions and 6 deletions

View File

@@ -3,11 +3,27 @@ import BaseHead from "./BaseHead.astro"
import Sidebar from "@components/sidebar" import Sidebar from "@components/sidebar"
import Navbar from "@components/index/navbar" import Navbar from "@components/index/navbar"
import Footer from "@components/footer" import Footer from "@components/footer"
const {
meta = {}
} = Astro.props;
const {
title = "",
description = "",
ogImage = "",
articleDate = ""
} = meta;
--- ---
<html> <html>
<head> <head>
<BaseHead/> <BaseHead
title={title}
description={description}
ogImage={ogImage}
articleDate={articleDate}
/>
</head> </head>

View File

@@ -3,7 +3,7 @@ import Base from "src/layout/Base.astro"
import Sidebar from "src/components/sidebar.astro" import Sidebar from "src/components/sidebar.astro"
--- ---
<Base> <Base meta={{title: "copyright"}}>
<div slot="content"> <div slot="content">
<p class="text-xl">Copyright & License</p> <p class="text-xl">Copyright & License</p>

View File

@@ -13,7 +13,7 @@ const records = await pb.collection('now').getFullList({
const lastUpdated = getFormattedDate(records[0].updated) const lastUpdated = getFormattedDate(records[0].updated)
--- ---
<Base> <Base meta={{title: "now"}}>
<div slot="sidebar" class="text-left"> <div slot="sidebar" class="text-left">
<h2>The Now!</h2> <h2>The Now!</h2>

View File

@@ -11,7 +11,7 @@ const photos = await pb.collection('photos').getFullList({
}) })
--- ---
<Base> <Base meta={{title: "photos"}}>
<div slot="sidebar"> <div slot="sidebar">
<p id="photo-title" class="bold text-2xl">{photos[0].title === "" ? "Untitled" : photos[0].title}</p> <p id="photo-title" class="bold text-2xl">{photos[0].title === "" ? "Untitled" : photos[0].title}</p>
<p id="photo-camera" class="text-sm">📸 {photos[0].camera}</p> <p id="photo-camera" class="text-sm">📸 {photos[0].camera}</p>

View File

@@ -20,7 +20,7 @@ const readTime = calcReadTime(wordCount);
--- ---
<Base> <Base meta={{title: "post", description: title, ogImage: headerImage, articleDate: publishDate}}>
<div slot="sidebar" class="text-left"> <div slot="sidebar" class="text-left">
<img src={headerImage}/> <img src={headerImage}/>

View File

@@ -17,7 +17,7 @@ const tags = posts.flatMap(p => p.tags)
const uniqueTags = tags.filter((v, i, a) => a.indexOf(v) === i) const uniqueTags = tags.filter((v, i, a) => a.indexOf(v) === i)
--- ---
<Base> <Base meta={{title: "posts"}}>
<div slot="sidebar" class="text-left"> <div slot="sidebar" class="text-left">
A few thoughts I've had, whenever I feel like it as you can see! A few thoughts I've had, whenever I feel like it as you can see!