大睡千秋

← 返回列表

这个站是怎么搭起来的

2026-10-12

把搭建过程记一下,以后自己回头翻也方便。

技术栈

  • nginx 托管静态文件
  • Let's Encrypt 免费证书,certbot 自动续期
  • 一个 Python 脚本,把 Markdown 渲染成 HTML

目录结构

/var/www/www.s1eep.vip
├── content/      文章源码(Markdown)
├── templates/    页面外壳
├── static/       CSS、图标
├── public/       生成结果,nginx 指向这里
└── build.py      构建脚本

写一篇新文章

  1. 在 content/posts/ 里新建文件,名字用 日期-短标题.md,比如 2026-10-13-周末.md
  2. 开头写上元信息:
---
title: 周末
date: 2026-10-13
summary: 列表页显示的一句话摘要
---
  1. 正文用 Markdown 随便写
  2. 跑一次构建:
cd /var/www/www.s1eep.vip && python3 build.py

刷新页面就能看到。

摘要可以省略,脚本会自己从正文里截一段。