feat: describe blog posts to search engines

This commit is contained in:
chrnx committed 2026-08-02 17:29:45 -05:00
1 parent 7ebf194d16
commit 2e2326b11e
2 files changed
+33 -2

No files matched your search

+32 -1
View File
@@ -23,9 +23,40 @@ const dateFormat = new Intl.DateTimeFormat('en-US', {
const wordCount = body.trim().split(/\s+/).filter(Boolean).length;
const readingTime = Math.max(1, Math.round(wordCount / 200));
const canonicalURL = new URL(Astro.url.pathname, Astro.site).toString();
const heroImageURL = new URL(heroImage ?? '/og.png', Astro.site).toString();
const structuredData = {
'@context': 'https://schema.org',
'@type': 'BlogPosting',
headline: title,
description,
image: heroImageURL,
datePublished: pubDate.toISOString(),
dateModified: (updatedDate ?? pubDate).toISOString(),
author: {
'@type': 'Person',
name: author,
},
publisher: {
'@type': 'Organization',
name: 'Expressive Tea Team',
},
mainEntityOfPage: canonicalURL,
...(tags && tags.length > 0 ? { keywords: tags.join(', ') } : {}),
};
---
<Base title={`${title} — Green Tea. Blog`} description={description} image={heroImage}>
<Base
title={`${title} — Green Tea. Blog`}
description={description}
image={heroImage}
ogType="article"
publishedTime={pubDate}
updatedTime={updatedDate ?? pubDate}
author={author}
tags={tags}
structuredData={structuredData}
>
<article class="post section">
<div class="wrap prose">
<p class="post-nav"><a href="/blog/">← Back to the blog</a></p>
+1 -1
View File
@@ -6,7 +6,7 @@ const title = '404 — Green Tea.';
const description = 'This page steeped too long. It’s gone — but the rest of the garden is right here.';
---
<Base title={title} description={description}>
<Base title={title} description={description} robots="noindex, follow">
<section class="notfound section">
<div class="wrap notfound__inner">
<div class="notfound__text">