web-projects/src/layouts/BaseLayout.astro

47 lines
1.7 KiB
Plaintext
Raw Normal View History

---
import '../styles/global.css';
interface Props {
title: string;
description: string;
ogImage?: string;
}
const { title, description, ogImage } = Astro.props;
const siteUrl = import.meta.env.SITE_URL || 'http://localhost:4321';
const ogImageUrl = ogImage || `${siteUrl}/og-default.png`;
---
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{title}</title>
<meta name="description" content={description} />
<meta name="robots" content="index, follow" />
<link rel="canonical" href={Astro.url.href} />
<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&family=Manrope:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap" rel="stylesheet">
<meta property="og:type" content="website" />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:url" content={Astro.url.href} />
<meta property="og:image" content={ogImageUrl} />
<meta property="og:site_name" content="知习 AI" />
<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} />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
</head>
<body class="antialiased overflow-x-hidden selection:bg-blue-100">
<slot />
</body>
</html>