參考來源

基本需求

  • 安裝 Node.js,建議安裝 LTS 版本

產生目錄

假設想在當前目錄,產生一個 blog 的資料夾

1
npx hexo-cli init blog

調整基本設定

參考頁:https://hexo.io/zh-tw/docs/configuration

  • 修改 _config.yml 針對需求,至少會調整到以下項目
1
2
3
4
5
title:
author:
language:
timezone: 'Asia/Taipei'
theme:

編寫文章

  • 直接在目錄 source/_posts/ 產生副檔名 .md 的檔案即可
  • 檔案開頭必備 title 欄位
1
2
3
---
title: Hello World
---

操作

  • 指令執行都在根目錄下
  • 其實相關指令參數在 package.json 中,對應 Hexo 實際操作

參考頁

Server

  • 我是當成預覽用途
1
npm run server

產生佈署用靜態檔案

  • 會自動建立 public 目錄
1
npm run build

清除佈署檔案

  • 會自動刪除 public 目錄
1
npm run clean