# 使用工具
- Hexo
- Github Pages
- CloudFlare
# Hexo 連接 Github
- 安裝套件
npm install -g hexo-cli | |
hexo init my-blog | |
cd my-blog | |
npm install hexo-deployer-git --save |
- 配置
_config.yml
在 Hexo 項目文件夾中的_config.yml
文件,找到deploy
部分,並進行如下配置:
deploy: | |
type: git | |
repo: https://github.com/<你的GitHub用戶名>/<你的倉庫名>.git | |
branch: gh-pages |
並且對 URL 跟 root 做設置,不然找不到網域
# URL | |
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project' | |
url: https://your-project.pages.dev | |
root: / |
- 生成靜態文件並部署
hexo generate | |
hexo deploy |
# CloudFlare 連接 Github Pages
-
註冊 CloudFlare 並打開 Pages 頁面
-
登入 Github 帳號並選擇 repo
-
設定名稱、分支
# 需要注意的小問題
Prism's Diff Highlight
警告
{hexo_blog路徑}\node_modules\prismjs\plugins\diff-highlight\prism-diff-highlight.js
的
// 可以註解掉 | |
console.warn("Prism's Diff Highlight plugin requires the Diff language definition (prism-diff.js)." + | |
"Make sure the language definition is loaded or use Prism's Autoloader plugin."); |