Files
hype404-static/src/layouts/Layout.astro

216 lines
5.8 KiB
Plaintext
Raw Normal View History

---
import { site } from '../lib/site.js';
const {
title,
description = site.description,
canonical,
image,
structuredData,
} = Astro.props;
const pageTitle = title || site.name;
const ogUrl = canonical || Astro.url.toString();
const year = new Date().getFullYear();
---
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{pageTitle}</title>
<meta name="description" content={description} />
{canonical && <link rel="canonical" href={canonical} />}
<link rel="icon" href="/favicon.ico" sizes="any" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="apple-touch-icon" href="/favicon-32x32.png" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content={site.name} />
<meta property="og:title" content={pageTitle} />
<meta property="og:description" content={description} />
{image && <meta property="og:image" content={image} />}
<meta property="og:url" content={ogUrl} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={pageTitle} />
<meta name="twitter:description" content={description} />
{image && <meta name="twitter:image" content={image} />}
{structuredData && (
<script type="application/ld+json" set:html={structuredData} />
)}
<link rel="alternate" type="application/rss+xml" title={`${site.name} RSS`} href="/rss.xml" />
<style is:global>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
line-height: 1.6;
color: #333;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
header {
border-bottom: 2px solid #eee;
padding-bottom: 20px;
margin-bottom: 30px;
}
header h1 { margin-bottom: 10px; }
header nav a {
margin-right: 20px;
text-decoration: none;
color: #666;
}
header nav a:hover { color: #333; }
.post {
border-bottom: 1px solid #eee;
padding: 20px 0;
}
.post-title { font-size: 1.5rem; margin-bottom: 10px; }
.post-title a { text-decoration: none; color: #333; }
.post-title a:hover { color: #0066cc; }
.post-meta { color: #999; font-size: 0.9rem; margin-bottom: 10px; }
.post-excerpt { color: #666; }
.post-content { line-height: 1.8; font-size: 1.1rem; }
.post-content h1, .post-content h2, .post-content h3 {
margin-top: 30px;
margin-bottom: 15px;
}
.post-content code {
background: #f4f4f4;
padding: 2px 6px;
border-radius: 3px;
}
.post-content pre {
background: #f4f4f4;
padding: 15px;
border-radius: 5px;
overflow-x: auto;
}
.post-content img { max-width: 100%; height: auto; }
.video-container {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
max-width: 100%;
margin: 20px 0;
}
.video-container iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
.tiktok-embed { margin: 20px 0; }
.twitter-tweet { margin: 20px auto; }
.tag {
display: inline-block;
background: #eee;
padding: 2px 8px;
border-radius: 3px;
font-size: 0.85rem;
margin-right: 5px;
}
.tag a { color: inherit; text-decoration: none; }
.back-link {
display: inline-block;
margin-bottom: 20px;
color: #0066cc;
text-decoration: none;
}
footer {
margin-top: 50px;
padding-top: 20px;
border-top: 1px solid #eee;
color: #999;
font-size: 0.9rem;
}
.pagination {
margin-top: 50px;
padding-top: 30px;
border-top: 1px solid #eee;
display: flex;
justify-content: space-between;
align-items: center;
}
.pagination-link {
display: inline-block;
padding: 10px 20px;
background: #f4f4f4;
border-radius: 5px;
text-decoration: none;
color: #333;
}
.pagination-info { color: #666; }
.related-posts {
margin-top: 60px;
padding-top: 40px;
border-top: 2px solid #eee;
}
.related-posts h3 {
font-size: 1.5rem;
margin-bottom: 25px;
color: #333;
}
.related-posts-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
}
.related-post-card {
border: 1px solid #eee;
border-radius: 8px;
padding: 20px;
transition: box-shadow 0.2s;
}
.related-post-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.related-post-link { text-decoration: none; color: inherit; }
.related-post-link h4 {
font-size: 1.1rem;
margin-bottom: 10px;
color: #333;
}
.related-post-excerpt {
font-size: 0.9rem;
color: #666;
margin-bottom: 10px;
line-height: 1.5;
}
.related-post-date { font-size: 0.8rem; color: #999; }
@media (max-width: 600px) {
.related-posts-grid { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<header>
<h1 style="display:flex; align-items:center; gap:12px; margin-bottom:10px;">
<a href="/" style="display:flex; align-items:center; gap:12px; text-decoration: none; color: #333;">
<img src="/favicon.png" alt="" width="40" height="40" style="border-radius: 8px; flex-shrink:0;" />
<span>{site.name}</span>
</a>
</h1>
<p style="color: #666; margin-bottom: 15px;">{site.description}</p>
<nav>
<a href="/">Home</a>
<a href="/about/">About</a>
</nav>
</header>
<main>
<slot />
</main>
<footer>
<p>&copy; {year} {site.name}. Powered by Astro.</p>
</footer>
</body>
</html>