-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDocLayout.astro
More file actions
71 lines (64 loc) · 2.45 KB
/
Copy pathDocLayout.astro
File metadata and controls
71 lines (64 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
import "../styles/global.css";
import Header from "../components/Header.astro";
import TableOfContents from "../components/TableOfContents.astro";
import TutorialLinks from "../components/TutorialLinks.astro";
import Footer from "../components/Footer.astro";
import site from "../data/site.json";
interface Props {
title: string;
description?: string;
headings?: { depth: number; slug: string; text: string }[];
currentPath?: string;
jsonLd?: Record<string, unknown>;
}
const { title, description, headings = [], currentPath = "/", jsonLd } = Astro.props;
const pageDescription = description || site.description;
const pageTitle = `${title} — ${site.title}`;
const canonicalUrl = new URL(Astro.url.pathname, Astro.site);
const ogImage = new URL("/tutorial-git/images/og-banner.png", Astro.site);
---
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{pageTitle}</title>
<meta name="description" content={pageDescription} />
<link rel="canonical" href={canonicalUrl} />
<!-- Open Graph -->
<meta property="og:type" content="article" />
<meta property="og:title" content={pageTitle} />
<meta property="og:description" content={pageDescription} />
<meta property="og:url" content={canonicalUrl} />
<meta property="og:image" content={ogImage} />
<meta property="og:site_name" content={site.title} />
<!-- Twitter Card -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={pageTitle} />
<meta name="twitter:description" content={pageDescription} />
<meta name="twitter:image" content={ogImage} />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&family=Roboto+Mono:wght@400;500&display=swap"
rel="stylesheet"
/>
{jsonLd && (
<script type="application/ld+json" set:html={JSON.stringify(jsonLd)} />
)}
</head>
<body>
<a href="#main-content" class="skip-link">Skip to main content</a>
<Header currentPath={currentPath} />
<div class="site-main">
<TableOfContents headings={headings} />
<main class="content" id="main-content">
<h1>{title}</h1>
<slot />
</main>
<TutorialLinks />
</div>
<Footer />
</body>
</html>