Skip to content

Commit 8bc6da4

Browse files
committed
Migrate blog to Astro preserving articles, counters and founding time
0 parents  commit 8bc6da4

994 files changed

Lines changed: 326820 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/pages.yml‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy Astro to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [astro-source]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: github-pages
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
if: github.ref == 'refs/heads/astro-source'
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Check out Astro source
23+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
24+
- name: Install, build, and upload static site
25+
uses: withastro/action@3eafd002e65cc31b4f0eae0bb05450d521562247 # v6
26+
with:
27+
node-version: '24'
28+
29+
deploy:
30+
if: github.ref == 'refs/heads/astro-source'
31+
needs: build
32+
runs-on: ubuntu-latest
33+
environment:
34+
name: github-pages
35+
url: ${{ steps.deployment.outputs.page_url }}
36+
steps:
37+
- name: Deploy to GitHub Pages
38+
id: deployment
39+
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5

‎.gitignore‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
node_modules/
2+
dist/
3+
.astro/
4+
.DS_Store
5+
.env*
6+
src/data/posts.json
7+
src/data/about.json
8+
migration/verification.json
9+
public/vendor/
10+
public/js/analytics.js
11+
content/drafts/
12+
migration/drafts-local.json
13+
migration/hexo-backup-manifest.json

‎README.md‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# SpriCoder Astro 博客
2+
3+
网站地址:https://spricoder.github.io/
4+
5+
这里是正在使用的 Astro 静态博客源码。原 `../SpriCoder-Blog/` 完整保留为 Hexo 备份;不要在那个目录构建或编辑新站。
6+
7+
## 写作与预览
8+
9+
- 已发布 Markdown:`content/posts/`,保留原有目录与文件名。
10+
- 原草稿:`content/drafts/`,仅保留在本地,已排除 Git 和网站发布。
11+
- 关于页原稿:`content/about/index.md`。
12+
- 图片:放入 `public/images/`,文章中使用 `/images/文件名`。
13+
14+
新文章至少填写 `title`、`date`(或 `pubDate`)、`description`。推荐填写 `tags`、`categories`;系列文章填写 `series`、`series_order`。新文章可以用 `permalink` 固定网址。
15+
16+
```yaml
17+
---
18+
title: 文章标题
19+
date: 2026-10-13
20+
description: 一两句介绍文章的问题与内容。
21+
tags: [数据库]
22+
series: 系列名称
23+
series_order: 1
24+
permalink: articles/example/
25+
---
26+
```
27+
28+
```sh
29+
npm ci
30+
npm run dev
31+
npm run build
32+
npm run preview
33+
```
34+
35+
## 存量文章保真
36+
37+
首次迁移完整保留 465 篇发布文章、6 篇本地草稿及原文章地址。存量文章未修改时,构建使用 `content/legacy/` 的已发布正文快照;修改 Markdown 后,自动使用新 Markdown 渲染器。新渲染器支持原 `post_link`、数学公式、脚注和 Mermaid。
38+
39+
`migration/baseline.json` 保存每篇原文校验值、地址、日期与旧快照信息;它使旧网址不随标题变化。原时间沿用基线,若需有意调整发布日期,可填写 `pubDate`。更新日期可填写 `updated`。已迁移页面保留代码、表格、公式和图片;一个旧 Bootstrap 教程的未闭合 HTML 已修复,正文文字未变。
40+
41+
关于页采用相同机制:直接编辑 `content/about/index.md`,修改后自动渲染。
42+
43+
搜索由 Pagefind 在构建后为全部发布文章生成分片全文索引。`migration/inherited-broken-references.json` 记录旧站已有的 31 项失效内链或图片;本次迁移未增加这些问题,也未重写原文。
44+
45+
## 统计与建站时间
46+
47+
继续使用原 LeanCloud 应用及总 PV/UV 记录,并保留原访客去重口径。统计配置是旧站已经使用的前端客户端配置;不要放入管理员密钥。
48+
49+
仅正式域名 `spricoder.github.io` 会新增计数。本地及其他预览域名仅查询;线上检查时使用 `?preview=1`,也不会累计测试访问。原建站脚本 `public/js/duration.js` 按字节保留,起始时间仍为 2019-09-01 12:00:00。
50+
51+
## 发布与回退
52+
53+
源码分支为 `astro-source`,旧 Hexo 发布基线为 `393b59514e93fcf7681f82616e864617035f3b46`。发布及回退说明见 [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md)。
54+
55+
本地迁移核验:`npm run verify`(需 Python 3 和 lxml)。校验原稿、全部文章正文、旧路径、本地图片、草稿隔离及 Hexo 备份完整性。

‎astro.config.mjs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineConfig } from 'astro/config';
2+
3+
export default defineConfig({
4+
site: 'https://spricoder.github.io',
5+
output: 'static',
6+
trailingSlash: 'always',
7+
build: { format: 'directory' },
8+
});

‎content/about/index.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: about
3+
date: 2022-02-15 17:15:27
4+
layout: about
5+
---
6+
7+
我是张洪胤(Hongyin Zhang,SpriCoder),毕业于南京大学软件学院,目前就读于清华大学软件学院。
8+
9+
我的工作聚焦于分布式时序系统与数据基础设施:参与 [Apache IoTDB](https://github.com/apache/iotdb),关注共识、指标与分布式数据库系统;参与 [Apache TsFile](https://github.com/apache/tsfile),关注列式时序存储格式;维护 [IoT Benchmark](https://github.com/thulab/iotdb-benchmark),用于可配置工作负载与正确性测试。
10+
11+
我也关注存储格式、基准测试与可观测性,并记录数据库、分布式系统、基准测试和软件工程实践。欢迎来到我的博客。

0 commit comments

Comments
 (0)