initial: Astro port of QipaoBuzz with AdSense + WebP images + tag filter

This commit is contained in:
2026-04-20 04:14:13 +00:00
commit 28ab757739
12414 changed files with 35942 additions and 0 deletions

242
src/layouts/Layout.astro Normal file
View File

@@ -0,0 +1,242 @@
---
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();
const ads = site.ads;
---
<!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} />}
<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" />
{ads?.enabled && (
<script
async
src={`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-${ads.publisherId}`}
crossorigin="anonymous"
/>
)}
<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; }
.ad-slot { margin: 30px 0; text-align: center; }
.ad-slot-top { margin: 20px 0; }
.ad-slot-in-article { margin: 30px 0; clear: both; }
@media (max-width: 600px) {
.related-posts-grid { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<header>
<h1><a href="/" style="text-decoration: none; color: #333;">{site.name}</a></h1>
<p style="color: #666; margin-bottom: 15px;">{site.description}</p>
<nav>
<a href="/">Home</a>
<a href="/about/">About</a>
</nav>
</header>
{ads?.enabled && (
<div class="ad-slot ad-slot-top">
<ins class="adsbygoogle"
style="display:block"
data-ad-client={`ca-pub-${ads.publisherId}`}
data-ad-slot={ads.adSlots.top}
data-ad-format="horizontal"
data-full-width-responsive="true"></ins>
<script set:html="(adsbygoogle = window.adsbygoogle || []).push({});" />
</div>
)}
<main>
<slot />
</main>
{ads?.enabled && (
<div class="ad-slot">
<ins class="adsbygoogle"
style="display:block"
data-ad-client={`ca-pub-${ads.publisherId}`}
data-ad-slot={ads.adSlots.bottom}
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script set:html="(adsbygoogle = window.adsbygoogle || []).push({});" />
</div>
)}
<footer>
<p>&copy; {year} {site.name}. Powered by Astro.</p>
</footer>
</body>
</html>