-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathBaseLayout.astro
More file actions
75 lines (64 loc) · 2.31 KB
/
Copy pathBaseLayout.astro
File metadata and controls
75 lines (64 loc) · 2.31 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
72
73
74
75
---
import "../styles/global.css";
import ThemeScript from "../components/ThemeScript.astro";
import Header from "../components/Header.astro";
import Footer from "../components/Footer.astro";
import SocialMeta from "../components/SocialMeta.astro";
import DraftModeToggle from "../components/DraftModeToggle.astro";
interface Props {
title: string;
description?: string;
ogImage?: string;
ogType?: 'website' | 'article';
publishedAt?: string;
author?: string;
canonicalUrl?: string;
}
const { title, description = "CodingCat.dev — Purrfect Web Tutorials", ogImage, ogType, publishedAt, author, canonicalUrl } = Astro.props;
const draftMode = Astro.cookies.has("__sanity_preview");
const visualEditingEnabled =
import.meta.env.PUBLIC_SANITY_VISUAL_EDITING_ENABLED === "true" || draftMode;
const currentPath = Astro.url.pathname || "/";
---
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<SocialMeta
title={title}
description={description}
ogImage={ogImage}
type={ogType}
publishedAt={publishedAt}
author={author}
canonicalUrl={canonicalUrl}
/>
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="alternate" type="application/rss+xml" title="CodingCat.dev Blog" href="/rss.xml" />
<link rel="alternate" type="application/rss+xml" title="CodingCat.dev Courses" href="/courses/rss.xml" />
{/* Dark mode script — MUST be before CSS to prevent FOUC */}
<ThemeScript />
{/* Fonts — Inter (body) + JetBrains Mono (code) */}
<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=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap"
rel="stylesheet"
/>
<title>{title}</title>
</head>
<body class="min-h-screen flex flex-col bg-[--bg] text-[--text]">
<Header />
<div class="flex-1">
<slot />
</div>
<Footer />
{visualEditingEnabled && (
<script>
import("../scripts/visual-editing").then((m) => m.run());
</script>
)}
<DraftModeToggle draftMode={draftMode} currentPath={currentPath} />
</body>
</html>