0%

Hexo tutorial

Writing & Organizing Content

  • 創新md檔案至 ~/Documents/Hexo/你的資料夾名稱/source/_posts
    1
    $ hexo new a
  • 創草稿md檔案至 ~/Documents/Hexo/你的資料夾名稱/source/_drafts

    1
    $ hexo new draft b

  • 在瀏覽器預覽draft檔案

    1
    $ hexo server --draft 

  • 發表draft檔案,檔案也會從 ~/_draft 被移到 ~/_posts

    1
    $ hexo publish b 

  • 在 ~/Documents/Hexo/你的資料夾名稱/_config.yml中

    1
    default_layout: post
    改成
    1
    default_layout: draft
    如此一來用
    1
    $ hexo new a
    就會預設創建草稿 (這才對吧,哪有人一new就發文ㄉ==)

  • 除了draft跟post以外,可以創單一個page
    這檔案會被存在 <個人網址>/aboutme

    1
    $ hexo new page aboutme

Scaffolds

  • Scaffolds裡面放了三個檔案用來定義Front Matter (創建md檔時的前幾行)
    • draft.md
    • page.md
    • post.md
    所以說可以透過修改這些檔案讓default format有更多花樣~

以修改 ~/scaffolds/draft.md 為例

1
2
3
4
---
title: {{ title }}
tags:
---
可以改成
1
2
3
4
5
6
---
title: {{ title }}
author: Yuan
tags:
---
## H1 TEXT

Tags & Categories

在Front Matter新增

1
2
3
4
5
---
tags: [tag1, tag2, tag3]
categories:
- [cat1, cat1.1]
---
如果tags跟categories的頁面沒出現就自己新增
1
2
$ hexo new page tags
$ hexo new page categories
接著修改
1. source/tags/index.md
1
2
3
4
5
6
---
title: tags
date: 產生當下時間
type: "tags"
comments: false
---
2. source/categories/index.md
1
2
3
4
5
6
---
title: categories
date: 產生當下時間
type: "categories"
comments: false
---

Tag Plugins

可以用Plugins放codeblock或是iframe (youtube)之類的
1. 插入程式碼

1
2
3
4
{% codeblock lang:python%}
code...
code...
{% endcodeblock %}
1
2
def add(x, y):
return x+y
2. 插入youtube
1
{% youtube I07XMi7MHd4%}