web-projects/src/layouts/BaseLayout.astro

107 lines
2.5 KiB
Plaintext
Raw Normal View History

---
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} />
<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>
<slot />
</body>
</html>
<style is:global>
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
:root {
--color-bg: #ffffff;
--color-bg-secondary: #f5f5f7;
--color-text: #1d1d1f;
--color-text-secondary: #86868b;
--color-accent: #0071e3;
--color-accent-hover: #0077ed;
--color-border: #d2d2d7;
--font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
--font-mono: ui-monospace, SFMono-Regular, "SF Mono", monospace;
--max-width: 980px;
--page-padding: clamp(1rem, 5vw, 2rem);
}
html {
font-family: var(--font-family);
font-size: 16px;
line-height: 1.5;
color: var(--color-text);
background: var(--color-bg);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
scroll-behavior: smooth;
}
body {
min-height: 100vh;
display: flex;
flex-direction: column;
}
main {
flex: 1;
}
a {
color: var(--color-accent);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
h1, h2, h3, h4, h5, h6 {
line-height: 1.2;
font-weight: 600;
}
img {
max-width: 100%;
height: auto;
}
button {
cursor: pointer;
font-family: inherit;
font-size: inherit;
}
</style>