Skip to content

Commit d970257

Browse files
committed
Simplify blog pages and prioritize technical series
1 parent 55db767 commit d970257

14 files changed

Lines changed: 62 additions & 92 deletions

File tree

‎src/components/Footer.astro‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const year = new Date().getFullYear();
77
<div class="footer-top">
88
<div>
99
<a class="footer-brand" href="/">SpriCoder<span>.</span></a>
10-
<p class="footer-note">持续记录,让知识与思考有所归处。</p>
1110
</div>
1211
<nav class="footer-links" aria-label="页脚导航">
1312
<a href="/atom.xml">RSS 订阅 <span aria-hidden="true">↗</span></a>
@@ -16,7 +15,7 @@ const year = new Date().getFullYear();
1615
</nav>
1716
</div>
1817
<div class="footer-bottom">
19-
<div class="footer-copyright">© {year} SpriCoder <span class="footer-divider" aria-hidden="true">/</span> Built with <a href="https://astro.build/" target="_blank" rel="noopener noreferrer">Astro</a></div>
18+
<div class="footer-copyright">© {year} SpriCoder <span class="footer-divider" aria-hidden="true">/</span> <a href="https://astro.build/" target="_blank" rel="noopener noreferrer">Astro</a></div>
2019
<div class="site-statistics" aria-label="网站访问统计">
2120
<span id="leancloud-site-pv-container">访问 <span id="leancloud-site-pv">—</span> 次</span>
2221
<span class="statistics-divider" aria-hidden="true">·</span>

‎src/components/Header.astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const active = (href: string) => href === '/' ? pathname === '/' : href === '/se
1313
<div class="header-inner container">
1414
<a class="wordmark" href="/" aria-label="SpriCoder 首页">
1515
<span class="wordmark-symbol" aria-hidden="true">S<span>.</span></span>
16-
<span class="wordmark-name">SpriCoder<span class="wordmark-caption">技术 · 思考 · 实践</span></span>
16+
<span class="wordmark-name">SpriCoder<span class="wordmark-caption">个人博客</span></span>
1717
</a>
1818
<div class="header-navigation">
1919
<nav class="main-nav" aria-label="主导航">

‎src/components/PostCard.astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ const topic = post.courseName || post.series || post.categories?.[0] || post.tag
2929
{post.description && <p class="post-card-description">{post.description}</p>}
3030
<div class="post-card-bottom">
3131
<span class="post-card-reading">约 {Math.max(1, post.readingMinutes || 1)} 分钟阅读</span>
32-
<a class="post-card-read" href={post.url} aria-label={`阅读:${post.title}`}>阅读全文 <span aria-hidden="true">↗</span></a>
32+
<a class="post-card-read" href={post.url} aria-label={`阅读:${post.title}`}>阅读全文</a>
3333
</div>
3434
</article>

‎src/layouts/SiteLayout.astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface Props {
1111
}
1212
1313
const {
14-
title = 'SpriCoder · 技术与研究笔记',
14+
title = 'SpriCoder 的博客',
1515
description = '记录关于数据库、时序数据、人工智能与软件工程的学习、研究和实践。',
1616
article = false,
1717
noindex = false,

‎src/pages/404.astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
import SiteLayout from '../layouts/SiteLayout.astro';
33
---
4-
<SiteLayout title="页面未找到" noindex><div class="container"><header class="page-header"><p class="eyebrow">404</p><h1>这条路径暂时没有内容</h1><p>你可以<a href="/search/">搜索文章</a>,或回到<a href="/archives/">完整归档</a>查找。</p></header></div></SiteLayout>
4+
<SiteLayout title="页面未找到" noindex><div class="container"><header class="page-header"><p class="eyebrow">404</p><h1>页面未找到</h1><p>你可以<a href="/search/">搜索文章</a>,或浏览<a href="/archives/">文章归档</a>。</p></header></div></SiteLayout>

‎src/pages/[...path].astro‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
import SiteLayout from '../layouts/SiteLayout.astro';
3-
import PostCard from '../components/PostCard.astro';
43
import { allPosts, dateLabel, seriesSlug, taxonomyUrl, courseOrder } from '../lib/posts';
54
import legacyRoutes from '../../migration/legacy-routes.json';
65
import baseline from '../../migration/baseline.json';
@@ -64,8 +63,8 @@ const nextCoursePost = courseIndex >= 0 ? coursePosts[courseIndex + 1] : null;
6463
{post.tags.length > 0 && <div class="tags">{post.tags.map(tag=><a href={taxonomyUrl('tags',tag)}>#{tag}</a>)}</div>}
6564
{post.course && <section class="series-navigation"><a class="text-link" href={`/courses/${post.course}/`}>返回「{post.courseName}」课程目录 →</a><div class="post-grid">{previousCoursePost && <div><p class="eyebrow">上一篇课程笔记</p><a href={previousCoursePost.url}>{previousCoursePost.title}</a></div>}{nextCoursePost && <div><p class="eyebrow">下一篇课程笔记</p><a href={nextCoursePost.url}>{nextCoursePost.title}</a></div>}</div></section>}
6665
{post.series && <section class="series-navigation"><a class="text-link" href={`/series/${seriesSlug(post.series)}/`}>查看「{post.series}」完整目录 →</a><div class="post-grid">{previous && <div><p class="eyebrow">上一篇</p><a href={previous.url}>{previous.title}</a></div>}{next && <div><p class="eyebrow">下一篇</p><a href={next.url}>{next.title}</a></div>}</div></section>}
67-
<section class="comments" aria-label="文章评论"><h2>交流与讨论</h2><script is:inline src="https://utteranc.es/client.js" repo="SpriCoder/spricoder-blog-comment" issue-term={post.counterPath !== post.url ? encodeURI(post.counterPath) : 'pathname'} theme="preferred-color-scheme" crossorigin="anonymous" async></script></section>
68-
</div> : <div class="container"><header class="page-header"><p class="eyebrow">THE ARCHIVE</p><h1>{listingTitle}</h1><p>{taxonomy ? `${labels.length} 个${taxonomy === 'tags' ? '标签' : '分类'}` : `${selected.length} 篇文章`} · 保存学习与实践的足迹</p><div class="archive-nav"><a href="/archives/">全部文章</a><a href="/categories/">按分类</a><a href="/tags/">按标签</a></div></header>{taxonomy ? <div class="tags taxonomy-tags">{labels.map(label=><a href={taxonomyUrl(taxonomy,label)}>{label} <span>{posts.filter(item=>item[taxonomy].includes(label)).length}</span></a>)}</div> : <div class="post-list">{selected.map(item=><PostCard post={item}/>)}</div>}</div>}
66+
<section class="comments" aria-label="文章评论"><h2>评论</h2><script is:inline src="https://utteranc.es/client.js" repo="SpriCoder/spricoder-blog-comment" issue-term={post.counterPath !== post.url ? encodeURI(post.counterPath) : 'pathname'} theme="preferred-color-scheme" crossorigin="anonymous" async></script></section>
67+
</div> : <div class="container"><header class="page-header"><h1>{listingTitle}</h1><p>{taxonomy ? `${labels.length} 个${taxonomy === 'tags' ? '标签' : '分类'}` : `${selected.length} 篇文章`}</p><div class="archive-nav"><a href="/archives/">全部文章</a><a href="/categories/">按分类</a><a href="/tags/">按标签</a></div></header>{taxonomy ? <div class="tags taxonomy-tags">{labels.map(label=><a href={taxonomyUrl(taxonomy,label)}>{label} <span>{posts.filter(item=>item[taxonomy].includes(label)).length}</span></a>)}</div> : <ul class="archive-list">{selected.map(item=><li><time datetime={item.date}>{dateLabel(item.date)}</time><a href={item.url}>{item.title}</a></li>)}</ul>}</div>}
6968
</SiteLayout>
7069
<script>
7170
const content = document.querySelector('.article-content');

‎src/pages/about.astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ import SiteLayout from '../layouts/SiteLayout.astro';
33
import about from '../data/about.json';
44
const html = about.html;
55
---
6-
<SiteLayout title="关于我"><div class="container"><header class="page-header"><p class="eyebrow">ABOUT</p><h1>关于 SpriCoder</h1><p>学习、实践,以及在过程中留下的记录。</p></header><article class="article-content" set:html={html}></article></div></SiteLayout>
6+
<SiteLayout title="关于我"><div class="container"><header class="page-header"><h1>关于 SpriCoder</h1></header><article class="article-content" set:html={html}></article></div></SiteLayout>

‎src/pages/courses/[...slug].astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if (ungroupedPosts.length > 0) groups.push({ id: 'other', label: '其他笔记',
3131
<p class="eyebrow">{course.domain} · {course.year ? course.year : '学习笔记'}</p>
3232
<h1>{course.name}</h1>
3333
<p>{course.description}</p>
34-
<div class="collection-summary"><span><strong>{posts.length}</strong> 篇笔记</span><span>按章节与资料类型整理</span></div>
34+
<div class="collection-summary"><span><strong>{posts.length}</strong> 篇笔记</span></div>
3535
</header>
3636
<div class="course-layout">
3737
<nav class="course-outline" aria-label="课程目录"><p>课程目录</p><ul>{groups.map((group, index) => <li><a href={`#group-${index + 1}`}><span>{group.label}</span><span>{group.posts.length}</span></a></li>)}</ul><a class="course-outline-back" href="/courses/">浏览其他课程 →</a></nav>

‎src/pages/courses/index.astro‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ const noteCount = posts.filter(post => post.course).length;
1111
<SiteLayout title="课程笔记" description="按课程与知识领域浏览计算机、软件工程和数据科学学习笔记。">
1212
<div class="container">
1313
<header class="page-header">
14-
<a class="breadcrumb" href="/series/">← 课程与专题</a>
15-
<p class="eyebrow">COURSE NOTES</p>
14+
<a class="breadcrumb" href="/series/">← 全部专题</a>
1615
<h1>课程笔记</h1>
17-
<p>把分散的课堂笔记、习题、实验和复习资料放回各自的课程。进入一门课程,沿章节顺序阅读现有记录。</p>
18-
<div class="collection-summary"><span><strong>{courses.length}</strong> 门课程</span><span><strong>{noteCount}</strong> 篇笔记</span><span>年份为笔记所属学习阶段</span></div>
16+
<p>课堂笔记、实验与复习资料。</p>
17+
<div class="collection-summary"><span><strong>{courses.length}</strong> 门课程</span><span><strong>{noteCount}</strong> 篇笔记</span></div>
1918
<nav class="course-domain-nav" aria-label="课程领域">{domains.map((domain, index) => <a href={`#domain-${index + 1}`}>{domain}</a>)}</nav>
2019
</header>
2120
<div class="course-directory">{domains.map((domain, index) => <section class="course-domain" aria-labelledby={`domain-${index + 1}`}><h2 id={`domain-${index + 1}`}>{domain}</h2><ul class="course-directory-list">{courses.filter(course => course.domain === domain).map(course => <li><a class="course-directory-link" href={`/courses/${course.slug}/`}><span class="course-directory-main"><span class="course-directory-title">{course.name}</span><span class="course-directory-description">{course.description}</span></span><span class="course-directory-meta"><span>{course.year ? course.year : '学习笔记'}</span><span>{courseCounts.get(course.slug)} 篇笔记</span><span aria-hidden="true">↗</span></span></a></li>)}</ul></section>)}</div>

‎src/pages/index.astro‎

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,29 @@ const featuredCourses = representativeDirectories.flatMap(directory => {
1717
const course = courses.find(course => course.sourceDirectory === directory);
1818
return course ? [course] : [];
1919
});
20-
const courseCounts = new Map(courses.map(course => [course.slug, posts.filter(post => post.course === course.slug).length]));
2120
const descriptions: Record<string, string> = {
22-
'与 AI 一起工作': '从任务、上下文与权限,到 Agent 协作、评测和科研。',
23-
'玩转时序数据集': '用 TsFile、IoTDB 与工具链理解、访问和验证时序数据。',
24-
'基准测试方法与实践': '工作负载、测试工具与性能结果背后的方法。',
21+
'与 AI 一起工作': 'AI 工具、Agent 协作、评测与科研实践。',
22+
'玩转时序数据集': 'TsFile、IoTDB、数据访问与常用工具。',
23+
'基准测试方法与实践': '工作负载设计、测试工具与性能结果分析。',
2524
};
2625
---
2726
<SiteLayout>
2827
<div class="container">
29-
<section class="hero">
30-
<p class="eyebrow">LEARNING · BUILDING · RESEARCHING</p>
31-
<h1>让实践留下思考,<br /><span>让思考连接下一步。</span></h1>
32-
<p class="hero-description">我是 SpriCoder。在这里记录数据库、时序数据与 AI 协作的学习和实践,也把积累的计算机与软件工程课程笔记整理成可循序阅读的专题。</p>
33-
<div class="hero-actions"><a class="button" href="/courses/">按课程阅读 <span aria-hidden="true">↗</span></a><a class="text-link" href="/series/">全部专题 →</a><a class="text-link" href="/about/">关于我 →</a></div>
34-
<div class="hero-stats"><span><strong>{posts.length}</strong> 篇文章</span><span><strong>{courses.length}</strong> 门课程笔记</span><span><strong>{series.length}</strong> 个技术系列</span><span>自 <strong>2019</strong> 年记录</span></div>
28+
<section class="home-intro">
29+
<h1>SpriCoder 的博客</h1>
30+
<p>这里记录我在数据库、时序数据和 AI 工具方面的学习与实践。</p>
3531
</section>
36-
<section class="home-section">
37-
<div class="section-heading"><div><p class="eyebrow">COURSE NOTES</p><h2>从一门课程,重温一组知识</h2></div><a class="text-link" href="/courses/">全部课程 →</a></div>
38-
<div class="course-feature-grid">{featuredCourses.map(course => <a class="course-feature" href={`/courses/${course.slug}/`}><span class="course-feature-domain">{course.domain} · {course.year}</span><h3>{course.name}</h3><p>{course.description}</p><span class="course-feature-meta">{courseCounts.get(course.slug)} 篇笔记 <span aria-hidden="true">↗</span></span></a>)}</div>
32+
<section class="home-section" aria-labelledby="technical-series">
33+
<div class="section-heading"><h2 id="technical-series">技术系列</h2><a class="text-link" href="/series/">全部专题</a></div>
34+
<div class="series-grid">{series.map(name => <a class="series-card" href={`/series/${seriesSlug(name)}/`}><h3>{name}</h3><p>{descriptions[name]}</p><span class="series-card-meta">{posts.filter(post => post.series === name).length} 篇文章</span></a>)}</div>
3935
</section>
40-
<section class="home-section">
41-
<div class="section-heading"><div><p class="eyebrow">TECHNICAL SERIES</p><h2>沿着一个问题,读一个系列</h2></div><a class="text-link" href="/series/#technical-series">技术系列 →</a></div>
42-
<div class="series-grid">{series.map((name, index) => <a class="series-card" href={`/series/${seriesSlug(name)}/`}><span class="series-number">0{index + 1}</span><h3>{name}</h3><p>{descriptions[name]}</p><span class="series-card-meta">{posts.filter(post => post.series === name).length} 篇文章 <span aria-hidden="true">↗</span></span></a>)}</div>
43-
</section>
44-
<section class="home-section">
45-
<div class="section-heading"><div><p class="eyebrow">LATEST WRITING</p><h2>最近的记录</h2></div><a class="text-link" href="/archives/">完整归档 →</a></div>
36+
<nav class="home-courses" aria-label="课程笔记">
37+
<span class="home-courses-label">课程笔记</span>
38+
{featuredCourses.map(course => <a href={`/courses/${course.slug}/`}>{course.name.replace(/\s*(\d{4})$/, '')}</a>)}
39+
<a class="home-courses-all" href="/courses/">全部课程 →</a>
40+
</nav>
41+
<section class="home-section" aria-labelledby="latest-posts">
42+
<div class="section-heading"><h2 id="latest-posts">最新文章</h2><a class="text-link" href="/archives/">全部文章</a></div>
4643
<div class="post-list">{posts.slice(0, 10).map(post => <PostCard post={post} />)}</div>
4744
</section>
4845
</div>

0 commit comments

Comments
 (0)