本站寫作指南:丟一個 Markdown 檔就能發文

這個站沒有資料庫也沒有後台:文章就是 Markdown 檔,放進目錄兩秒內上線。本文整理 front-matter 欄位、特殊區塊語法與發佈流程。

2 分鐘閱讀 版本:aiagent.jxdtw.com v1

檔案放哪裡

文章放在 content/posts/<分類>/ 底下,目錄名就是分類。分類定義在 content/taxonomy.yml,打錯目錄名會被 lint 擋下。

  • 單檔:content/posts/claude/my-post.md
  • 資料夾式(要放圖片用這種):content/posts/claude/my-post/index.md + 同資料夾的圖片

用腳本建立骨架最省事:

scripts/new-post.sh claude my-post --folder

Front-matter

每篇文章開頭是一段 YAML。必填四個欄位:

欄位 說明
title 標題
date 發佈日期;寫未來日期=排程發佈
summary 摘要(卡片、搜尋、RSS 都會用)
type tutorial / experience / comparison / workflow

常用的選填欄位:tags、series + series_order、difficulty、tools_version、updated、cover、aliases、draft。

📝 備註

draft: true 的文章不會出現在任何列表、搜尋、RSS 或 sitemap;直接輸入網址也是 404。

特殊區塊

除了標準 Markdown(含表格、腳註、任務清單),本站支援幾種容器:

💡 Tip

用 :::tip 開頭、單獨一行 ::: 結尾。支援 tip、warning、note、cmd、prompt。

prompt 區塊會附「複製」按鈕,適合放可直接貼給 AI 的提示詞:

🧠 Prompt

請幫我檢查這段程式有沒有競態條件,並說明你的判斷依據。

程式碼區塊會自動語法高亮,也有複製按鈕:

<?php
echo "hello, aiagent";

發佈

  1. php bin/build.php --check 檢查 front-matter 與圖片
  2. scripts/publish.sh 只同步 content/ 並在主機重建索引
  3. 打開網站確認
⚠️ 注意

raw HTML 與 <script> 會被移除,SVG 圖片不允許;需要嵌入影片請用 ::youtube[影片ID]。

Sean用 AI Agent 寫程式、做自動化,把踩過的坑寫下來。

相關文章