perf: improve SEO and page performance #3
No files matched your search
+32
-1
@@ -23,9 +23,40 @@ const dateFormat = new Intl.DateTimeFormat('en-US', {
|
|||||||
|
|
||||||
const wordCount = body.trim().split(/\s+/).filter(Boolean).length;
|
const wordCount = body.trim().split(/\s+/).filter(Boolean).length;
|
||||||
const readingTime = Math.max(1, Math.round(wordCount / 200));
|
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">
|
<article class="post section">
|
||||||
<div class="wrap prose">
|
<div class="wrap prose">
|
||||||
<p class="post-nav"><a href="/blog/">← Back to the blog</a></p>
|
<p class="post-nav"><a href="/blog/">← Back to the blog</a></p>
|
||||||
|
|||||||
+1
-1
@@ -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.';
|
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">
|
<section class="notfound section">
|
||||||
<div class="wrap notfound__inner">
|
<div class="wrap notfound__inner">
|
||||||
<div class="notfound__text">
|
<div class="notfound__text">
|
||||||
|
|||||||
Reference in new issue
Block a user