Files
blog/rss.xsl
T
2026-07-19 16:12:13 +08:00

262 lines
7.8 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:atom="http://www.w3.org/2005/Atom">
<xsl:output method="html" encoding="UTF-8" indent="yes" doctype-system="about:legacy-compat"/>
<xsl:template match="/">
<html lang="zh-CN">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title><xsl:value-of select="/rss/channel/title"/> RSS</title>
<style>
:root {
color-scheme: light dark;
--bg: #f6f4ee;
--surface: #fffdf8;
--text: #20242a;
--muted: #65707a;
--line: #dfd8ca;
--accent: #0f766e;
--accent-soft: #d9f3ee;
--shadow: 0 18px 48px rgba(45, 39, 28, 0.12);
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #0f171a;
--surface: #162225;
--text: #e9f0ee;
--muted: #a7b4b1;
--line: rgba(174, 205, 197, 0.18);
--accent: #72ded2;
--accent-soft: rgba(114, 222, 210, 0.14);
--shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}
}
* {
box-sizing: border-box;
}
body {
margin: 0;
color: var(--text);
font-family: ui-serif, "Songti SC", "Noto Serif CJK SC", Georgia, serif;
line-height: 1.75;
background:
linear-gradient(rgba(246, 244, 238, 0.88), rgba(246, 244, 238, 0.98)),
url("/images/background.png") center top / cover fixed,
var(--bg);
}
@media (prefers-color-scheme: dark) {
body {
background:
linear-gradient(rgba(8, 13, 16, 0.88), rgba(10, 17, 20, 0.96)),
url("/images/background.png") center top / cover fixed,
var(--bg);
}
}
a {
color: inherit;
text-decoration: none;
}
.wrap {
width: min(1040px, calc(100% - 32px));
margin: 0 auto;
padding: 48px 0 56px;
}
.hero {
display: grid;
gap: 18px;
padding: clamp(28px, 5vw, 52px);
border: 1px solid rgba(255, 255, 255, 0.62);
border-radius: 8px;
background: color-mix(in srgb, var(--surface) 86%, transparent);
box-shadow: var(--shadow);
backdrop-filter: blur(18px) saturate(150%);
}
.badge {
display: inline-flex;
width: fit-content;
align-items: center;
gap: 8px;
padding: 6px 12px;
border: 1px solid var(--line);
border-radius: 999px;
color: var(--accent);
font: 700 0.86rem/1.2 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
background: var(--accent-soft);
}
.badge svg {
width: 16px;
height: 16px;
fill: currentColor;
}
h1 {
max-width: 12ch;
margin: 0;
font-size: clamp(2.3rem, 6vw, 4.8rem);
line-height: 1.05;
letter-spacing: 0;
}
.description {
max-width: 680px;
margin: 0;
color: var(--muted);
font-size: clamp(1rem, 2vw, 1.18rem);
}
.actions {
display: flex;
flex-wrap: wrap;
gap: 10px;
align-items: center;
color: var(--muted);
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
font-size: 0.94rem;
}
.button {
display: inline-flex;
min-height: 42px;
align-items: center;
justify-content: center;
padding: 8px 14px;
border: 1px solid var(--accent);
border-radius: 999px;
color: #fff;
background: var(--accent);
font-weight: 700;
}
.button.secondary {
color: var(--accent);
background: transparent;
}
.feed {
display: grid;
gap: 14px;
margin-top: 24px;
}
.item {
padding: clamp(20px, 4vw, 30px);
border: 1px solid var(--line);
border-radius: 8px;
background: color-mix(in srgb, var(--surface) 92%, transparent);
box-shadow: 0 10px 30px rgba(45, 39, 28, 0.08);
}
.item h2 {
margin: 0;
font-size: clamp(1.25rem, 3vw, 1.75rem);
line-height: 1.35;
letter-spacing: 0;
}
.item h2 a:hover {
color: var(--accent);
}
.meta {
margin: 8px 0 0;
color: var(--muted);
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
font-size: 0.9rem;
}
.summary {
margin: 14px 0 0;
color: var(--muted);
}
.summary * {
max-width: 100%;
}
.summary a {
color: var(--accent);
text-decoration: underline;
text-underline-offset: 3px;
}
.read {
display: inline-flex;
margin-top: 14px;
color: var(--accent);
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
font-weight: 700;
}
@media (max-width: 640px) {
.wrap {
width: min(100% - 20px, 1040px);
padding-top: 20px;
}
.hero {
padding: 24px 18px;
}
.actions {
align-items: stretch;
flex-direction: column;
}
.button {
width: 100%;
}
}
</style>
</head>
<body>
<main class="wrap">
<section class="hero">
<div class="badge">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M6.18 17.82a2.18 2.18 0 1 1 0 4.36 2.18 2.18 0 0 1 0-4.36ZM4 9.5c5.8 0 10.5 4.7 10.5 10.5h-3A7.5 7.5 0 0 0 4 12.5v-3Zm0-6C13.11 3.5 20.5 10.89 20.5 20h-3C17.5 12.55 11.45 6.5 4 6.5v-3Z"/>
</svg>
RSS Feed
</div>
<h1><xsl:value-of select="/rss/channel/title"/></h1>
<p class="description"><xsl:value-of select="/rss/channel/description"/></p>
<div class="actions">
<a class="button" href="{/rss/channel/link}">返回博客</a>
<a class="button secondary" href="/rss.xml">订阅源地址</a>
<span>把这个地址添加到 RSS 阅读器,就能持续收到新文章。</span>
</div>
</section>
<section class="feed" aria-label="文章列表">
<xsl:for-each select="/rss/channel/item">
<article class="item">
<h2>
<a href="{link}">
<xsl:value-of select="title"/>
</a>
</h2>
<p class="meta"><xsl:value-of select="pubDate"/></p>
<div class="summary">
<xsl:value-of select="description" disable-output-escaping="yes"/>
</div>
<a class="read" href="{link}">阅读全文</a>
</article>
</xsl:for-each>
</section>
</main>
</body>
</html>
</xsl:template>
</xsl:stylesheet>