101 lines
3.0 KiB
Plaintext
101 lines
3.0 KiB
Plaintext
---
|
|
import Header from '../components/Header.astro';
|
|
import Footer from '../components/Footer.astro';
|
|
import '../styles/global.css';
|
|
|
|
type OpenGraphType = 'website' | 'article';
|
|
type StructuredData = Record<string, unknown>;
|
|
|
|
interface Props {
|
|
title?: string;
|
|
description?: string;
|
|
image?: string;
|
|
ogType?: OpenGraphType;
|
|
robots?: string;
|
|
publishedTime?: Date;
|
|
updatedTime?: Date;
|
|
authorUrl?: string;
|
|
tags?: string[];
|
|
structuredData?: StructuredData;
|
|
}
|
|
|
|
const {
|
|
title = 'Green Tea — A zen, type-safe graph-pipeline HTTP framework',
|
|
description = 'Green Tea is a graph-pipeline HTTP framework: declare what you need, not the order to build it. Runtime-agnostic, type-safe, calm by design.',
|
|
image = '/og.png',
|
|
ogType = 'website',
|
|
robots = 'index, follow',
|
|
publishedTime,
|
|
updatedTime,
|
|
authorUrl,
|
|
tags,
|
|
structuredData,
|
|
} = Astro.props;
|
|
|
|
const canonicalURL = new URL(Astro.url.pathname, Astro.site).toString();
|
|
const ogImageURL = new URL(image, Astro.site).toString();
|
|
const serializedStructuredData = structuredData
|
|
? JSON.stringify(structuredData).replace(/</g, '\\u003c')
|
|
: undefined;
|
|
---
|
|
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
<link rel="canonical" href={canonicalURL} />
|
|
|
|
<title>{title}</title>
|
|
<meta name="description" content={description} />
|
|
<meta name="robots" content={robots} />
|
|
|
|
<!-- Open Graph -->
|
|
<meta property="og:type" content={ogType} />
|
|
<meta property="og:url" content={canonicalURL} />
|
|
<meta property="og:title" content={title} />
|
|
<meta property="og:description" content={description} />
|
|
<meta property="og:image" content={ogImageURL} />
|
|
{
|
|
ogType === 'article' && (
|
|
<>
|
|
{publishedTime && <meta property="article:published_time" content={publishedTime.toISOString()} />}
|
|
{updatedTime && <meta property="article:modified_time" content={updatedTime.toISOString()} />}
|
|
{authorUrl && <meta property="article:author" content={authorUrl} />}
|
|
{tags?.map((tag) => <meta property="article:tag" content={tag} />)}
|
|
</>
|
|
)
|
|
}
|
|
|
|
<!-- Twitter -->
|
|
<meta name="twitter:card" content="summary_large_image" />
|
|
<meta name="twitter:title" content={title} />
|
|
<meta name="twitter:description" content={description} />
|
|
<meta name="twitter:image" content={ogImageURL} />
|
|
|
|
{serializedStructuredData && <script type="application/ld+json" set:html={serializedStructuredData} />}
|
|
|
|
<!-- RSS -->
|
|
<link rel="alternate" type="application/rss+xml" title="Green Tea. Blog" href="/rss.xml" />
|
|
|
|
<!-- Fonts -->
|
|
<link
|
|
rel="preload"
|
|
href="/fonts/zen-maru-gothic-latin-700.woff2"
|
|
as="font"
|
|
type="font/woff2"
|
|
crossorigin
|
|
/>
|
|
|
|
<meta name="generator" content={Astro.generator} />
|
|
</head>
|
|
<body>
|
|
<Header />
|
|
<main>
|
|
<slot />
|
|
</main>
|
|
<Footer />
|
|
</body>
|
|
</html>
|