Hello, Github-Hexo-NexT
Needs
==Github Page + Hexo框架 + NexT主題==
- Free
- Own Blog
- Easy Use
- Flexibility
Quick Start
Github Page
- 先有一個Github帳號
- 去新增專案(New repository)
- repository name必填為”your_github_name.github.io”
- 設定完成後,進入”https://your_github_name.github.io/“ 頁面就是屬於你的網頁了!
Hexo框架
- windows系統的電腦直接安裝Node.js
- 就可以cmd下
1
2npm install -g hexo-cli # 安裝hexo框架
hexo init blog #在當前目錄建立一個blog資料夾 - 把blog裡面的檔案全部複製到你剛建的git local repo
- 就可以cmd下
1
npm install #根據"package.json"自動安裝需要的套件
- 為了快速先看到有東西,必須先對”_config.yml”其中三部分做基本修改,以下為我的範例config
5-1. # Site5-2. # URL1
2
3
4
5
6
7title: Kate's Blog
subtitle: 'subtitle'
description: 'description'
keywords:
author: Kate Cheng
language: zh-TW
timezone: 'Asia/Taipei'5-3. # Deployment1
2
3
4
5
6
7
8## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: https://kk034kk034.github.io/
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
trailing_html: true # Set to false to remove trailing '.html' from permalinks1
2
3
4
5## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: git
repo: https://github.com/kk034kk034/kk034kk034.github.io.git
branch: main - 就可以cmd下以下指令部屬看結果~
1
2
3
4hexo clean #將目前資料夾中的所有靜態網頁清除
hexo generate #或hexo g,
hexo server #會部屬在本地(127.0.0.1:4000),用來確認當前設計
hexo deploy #或hexo d,將本地靜態網頁自動部屬到Git Page,所以5-3的部分要設定正確
NexT主題
- 尋找自己喜歡的Hexo Themes
- 我最後是裝NexT主題
1
git clone https://github.com/next-theme/hexo-theme-next themes/next
- 並修改”_config.yml”的
theme: next - 接下來就都是”themes/next/_config.yml”的事了,以下為我的範例config
4-1. # Schemes4-2. # Dark Mode1
scheme: Gemini
4-3. # Menu Settings1
darkmode: true
4-4. # Sidebar Avatar1
2
3
4
5
6menu:
home: / || home
about: /about/ || user
tags: /tags/ || tags
categories: /categories/ || th
archives: /archives/ || archive4-5. # Social Links1
2
3
4
5
6
7avatar:
# Replace the default image and set the url here.
url: /images/GGC02414-1.jpg
# If true, the avatar will be displayed in circle.
rounded: false
# If true, the avatar will be rotated with the cursor.
rotated: false1
2
3social:
GitHub: https://github.com/kk034kk034 || fab fa-github
LinkedIn: https://www.linkedin.com/in/kate-cheng-a8b94a189/ || fab fa-linkedin - 其中,about、tags、categories,要用hexo指令額外建Page點進去才會有東西
5-1. 增加”關於”接著修改剛剛產生的 source/about/inex.md 成下面的樣子並儲存。1
hexo new page about
5-2. 增加”標籤”1
2
3
4
5---
title: about
date: 2024-07-25 01:34:24
type: "page"
---接著修改剛剛產生的 source/tags/inex.md 成下面的樣子並儲存。1
hexo new page tags
5-3. 增加”分類”1
2
3
4
5---
title: tags
date: 2024-07-25 04:02:34
type: "tags"
---接著修改剛剛產生的 source/categories/inex.md 成下面的樣子並儲存。1
hexo new page categories
1
2
3
4
5---
title: categories
date: 2024-07-25 04:01:49
type: "categories"
--- - 最後就是可以開始寫文章以及使用分類、標籤功能啦接著在剛剛產生的 source/_posts/Hello-Github-Hexo-NexT.md 頭部增加”categories:”與”tags:”範例如下,就可以開始用MarkDown語法寫文章啦!
1
hexo new post "Hello, Github-Hexo-NexT"
---
title: Hello, Github-Hexo-NexT
date: 2024-07-25 11:31:52
categories:
- build
tags:
- blog
---