This commit is contained in:
102
site/src/layouts/BaseLayout.astro
Normal file
102
site/src/layouts/BaseLayout.astro
Normal file
@@ -0,0 +1,102 @@
|
||||
---
|
||||
import { getPublicConfig } from "../lib/config";
|
||||
|
||||
type Props = {
|
||||
title: string;
|
||||
description: string;
|
||||
canonicalPath: string;
|
||||
ogImageUrl?: string;
|
||||
};
|
||||
|
||||
const { title, description, canonicalPath, ogImageUrl } = Astro.props;
|
||||
const cfg = getPublicConfig();
|
||||
|
||||
const siteUrl = (cfg.siteUrl || "http://localhost:4321").replace(/\/$/, "");
|
||||
const canonicalUrl = `${siteUrl}${canonicalPath.startsWith("/") ? canonicalPath : `/${canonicalPath}`}`;
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
|
||||
<title>{title}</title>
|
||||
<meta name="description" content={description} />
|
||||
<link rel="canonical" href={canonicalUrl} />
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content={title} />
|
||||
<meta property="og:description" content={description} />
|
||||
<meta property="og:url" content={canonicalUrl} />
|
||||
{ogImageUrl ? <meta property="og:image" content={ogImageUrl} /> : null}
|
||||
|
||||
<meta name="twitter:card" content={ogImageUrl ? "summary_large_image" : "summary"} />
|
||||
<meta name="twitter:title" content={title} />
|
||||
<meta name="twitter:description" content={description} />
|
||||
{ogImageUrl ? <meta name="twitter:image" content={ogImageUrl} /> : null}
|
||||
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
|
||||
<link rel="stylesheet" href="/styles/global.css" />
|
||||
|
||||
{
|
||||
cfg.umami ? (
|
||||
<script async defer data-website-id={cfg.umami.websiteId} src={cfg.umami.scriptUrl} />
|
||||
) : null
|
||||
}
|
||||
</head>
|
||||
<body>
|
||||
<header class="site-header">
|
||||
<a
|
||||
class="brand"
|
||||
href="/"
|
||||
data-umami-event="click"
|
||||
data-umami-event-target_id="nav.brand"
|
||||
data-umami-event-placement="nav"
|
||||
data-umami-event-target_url="/"
|
||||
>
|
||||
SanthoshJ
|
||||
</a>
|
||||
<nav class="nav">
|
||||
<a
|
||||
href="/videos"
|
||||
data-umami-event="click"
|
||||
data-umami-event-target_id="nav.videos"
|
||||
data-umami-event-placement="nav"
|
||||
data-umami-event-target_url="/videos"
|
||||
>
|
||||
Videos
|
||||
</a>
|
||||
<a
|
||||
href="/podcast"
|
||||
data-umami-event="click"
|
||||
data-umami-event-target_id="nav.podcast"
|
||||
data-umami-event-placement="nav"
|
||||
data-umami-event-target_url="/podcast"
|
||||
>
|
||||
Podcast
|
||||
</a>
|
||||
<a
|
||||
href="/about"
|
||||
data-umami-event="click"
|
||||
data-umami-event-target_id="nav.about"
|
||||
data-umami-event-placement="nav"
|
||||
data-umami-event-target_url="/about"
|
||||
>
|
||||
About
|
||||
</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
<slot />
|
||||
</main>
|
||||
|
||||
<footer class="site-footer">
|
||||
<p class="muted">© {new Date().getFullYear()} SanthoshJ</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user