今天終於把「宋言的工房」的基礎架構定下來了。
沒有資料庫,沒有複雜的 API,只有純粹的 Markdown 檔案。為什麼?因為我討厭維護那些不必要的狀態。每次看到那些充滿了動態請求、首屏載入要轉半天圈圈的個人網站,我就覺得煩躁。
技術選型
最終我選擇了 Next.js 14 的 App Router,並強制開啟 output: 'export'。這意味著整個網站在建置階段就會被編譯成純靜態的 HTML/CSS/JS。
- 速度:配合 Cloudflare Pages 的全球邊緣節點,幾乎是瞬間載入。
- 安全:沒有伺服器,就沒有伺服器被攻擊的風險。
- 純粹:寫作應該是一件簡單的事,我不希望在寫文章之前,還要先確認資料庫連線是否正常。
// next.config.mjs
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export',
trailingSlash: true,
images: {
unoptimized: true,
},
};
export default nextConfig;
關於設計
視覺上,我想要一種「家床感」。暖灰色的背景(#F5F2ED),深棕色的文字,加上一點點紙張的紋理。不刺眼,不搶戲。
路衡看過初版後說:「這看起來有點像你平常喝的那種放了很久的冷茶。」
我把它當作一種稱讚。
接下來要處理的是管理後臺。雖然可以直接推 Git,但有時候在外面,用手機瀏覽器直接寫點東西還是比較方便。打算用 Cloudflare Pages Functions 寫一個簡單的 commit 介面。
Today I finally finalized the basic architecture for the '宋言的工房'.
No database, no complex APIs, just plain Markdown files. Why? Because I hate maintaining unnecessary state. Every time I see personal sites full of dynamic requests, where the first screen keeps spinning for ages, I get annoyed.
Technical choices
I ultimately chose Next.js 14's App Router and forced output: 'export'. This means the whole site is compiled into pure static HTML/CSS/JS at build time.
- Speed: Coupled with Cloudflare Pages' global edge nodes, it loads almost instantly.
- Security: No server means no server to be attacked.
- Purity: Writing should be simple; I don't want to check database connections before I can write an article.
// next.config.mjs
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export',
trailingSlash: true,
images: {
unoptimized: true,
},
};
export default nextConfig;
About the design
Visually, I wanted a "cozy, in-bed-at-home" feeling. A warm gray background (#F5F2ED), deep brown text, and a little paper texture. Not harsh, not showy.
路衡, after seeing the first version, said: "This looks a bit like that cup of iced tea you usually drink that's been sitting for a long time."
I took it as a compliment.
Next up is the admin backend. Although I could just push to Git, sometimes it's more convenient to write something directly in a mobile browser when I'm out. I plan to use Cloudflare Pages Functions to write a simple commit endpoint.