設定了這麼多特效,該來看看要怎麼發文章吧?
# 直接建立正式文章(會在 source/_posts/ 下)
hexo new "DAY11 來寫第一篇文章"
# 先寫草稿、寫好再發佈
hexo new draft "DAY11 來寫第一篇文章"
# 草稿寫好 → 發佈成正式文章
hexo publish "DAY11 來寫第一篇文章"
草稿會放在 `source/_drafts/`;正式文在 `source/_posts/`。
或是你直接去source/_posts/建立一個.md的檔案 (檔案名稱就是文章標題)
開啟剛建立的 .md
,在最上面加(或修改)這段:
---
title: 第六篇:Kira 主題加上旋轉頭像與導向
date: 2025-09-01 15:30:00
tags: [Hexo, Kira, Butterfly效果, 教學]
categories:
- 個人網站
- Hexo
description: 在 Kira 主題加入滑鼠移到頭像旋轉的做法
cover: /images/covers/day11.jpg # 可選,若沒設定cover就會選擇背景圖當作文章大圖
---
讓「/tags」「/categories」頁面能自動列出所有標籤/分類:
hexo new page tags
hexo new page categories
把 source/tags/index.md
改成:
---
title: 標籤
type: tags
---
把 source/categories/index.md
改成:
---
title: 分類
type: categories
---
接下來是,發文時要用的格式,比如說發程式碼等或是需要高亮表記
在句子中用一個反引號:例:console.log('Hello')
你在.md檔中寫的 大家實際看到的
用三個反引號包住,後面加語言名稱(一定要加,才會高亮!):
```js
document.addEventListener('DOMContentLoaded', () => {
console.log('Hello Hexo');
});
常用語言代碼:`bash`、`powershell`、`js`、`ts`、`json`、`yaml`、`html`、`css`、`python`。
## 4.3 顯示檔名的小技巧
Markdown不一定支援「標題列」,最通用的是在第一行加註解或註釋:
```markdown
```js
// 檔名:source/js/avatar-redirect.js
document.addEventListener('DOMContentLoaded', () => {/*...*/})
# 5) 開啟程式碼高亮&行號(Hexo 全域設定)
在**站點的** `_config.yml`(根目錄)確認以下其中一種:
### 用 highlight.js(Hexo 內建,穩)
```yaml
highlight:
enable: true
line_number: true
auto_detect: true
tab_replace:
prismjs:
enable: false
highlight:
enable: false
prismjs:
enable: true
preprocess: true
line_number: true
在想要截斷的位置插入一行:
你的開場介紹…
<!-- more -->
後面是全文內容
先在根 _config.yml
打開:
post_asset_folder: true
之後 hexo new "標題"
會同時產生一個同名資料夾。把圖片丟進去,文內直接寫:

(Hexo 會自動指到同名資料夾底下的檔)
最後呈現出的網頁長這樣