Hexo 使用
command
Install Hexo
1 | Install Hexo |
Dump version
1 | hexo version |
inition Blog
1 | hexo init blog |
產生靜態檔後部署
1 | hexo d -g |
產生靜態檔後預覽
1 | hexo s -g |
啟動伺服器
1 | hexo server (hexo s) |
啟動伺服器(含 debug data)
1 | hexo s --debug |
產生靜態檔案
1 | hexo generate (hexo g) |
變更連接埠
1 | hexo server -p 5000 |
部署網站
1 | hexo deploy (hexo d) |
清除靜態檔案與快取
1 | hexo clean |
產生文章
1 | hexo new post_name |
產生草稿
1 | hexo new draft "new draft" |
產生 page
1 | hexo new page about |
npm 安裝
install hexo-deployer-git(for _config.yml’s type: git)
1 | npm install hexo-deployer-git --save |
install hexo-image-link(Markdown 顯示圖片 規則)
1 | npm install hexo-image-link --save |
1 | ![picture 1](hexo/test.png) |
instrall 管理文章的後台插件(不好用,也會產生很多 npm vulnerabilities-漏洞)
1 | npm install hexo-admin --save |
設定檔案編輯
_config.yml(for GitHub)
1 | deploy: |
_config.yml(for 圖片放於對應的目錄下)
1 | post_asset_folder: true |
_config.yml(for 網址設定)
1 | url: https://hot5656.github.io/blog/ |
_config.yml(for 網頁基本設定)
1 | # Site |
_config.yml(for 首頁一頁要顯示幾篇文章)
1 | index_generator: |
_config.next.yml (for 列出所有搜尋結果)
1 | # Show top n results per article, show all results by setting to -1 |
md檔 設定
加入 繼續閱讀 截斷文章
1 | <!--more--> |
page 改成一般 HTML 格式
index.md change to index.html
整頁完全受page layout 影響(填入以下)
1 | --- |
設定 Hexo 本地連結
{% post_link filename [title] [escape] %}
show hexo’s post title
1 | {% post_link hexo-1 %} |
show 指定文字
1 | {% post_link hexo-1 'Hexo 製作部落格' %} |
Escape title(don’t care tag)
1 | {% post_link hexo-1 '<b>Hexo</b> 製作部落格' %} |
Do not Escape title(care tag)
1 | {% post_link hexo-1 '<b>Hexo</b> 製作部落格' false %} |
顯示圖檔
default 顯示
1 | {% asset_img pic2.jpg pic2 %} |
![pic2](/2021/03/14/hexo-3/pic2.jpg)
設定外框寬度(可靠左或縮小圖片)
1 | <div style="width:500px"> |
![pic2](/2021/03/14/hexo-3/pic2.jpg)
加入自訂 class
1 | <style> |
![pic2](/2021/03/14/hexo-3/pic2.jpg)
指定寬度,高度
1 | {% asset_img pic2.jpg 300 300 "pic2"%} |
![pic2](/2021/03/14/hexo-3/pic2.jpg)
指定寬度(自動調整高度)
1 | {% asset_img pic2.jpg 300 "pic2"%} |
![pic2](/2021/03/14/hexo-3/pic2.jpg)
指定 Title & Alt
alt 圖片替代文字
title 滑鼠移經顯示文字標示
1 | {% asset_img pic2.jpg "pic2 title'pic2 alt'" %} |
![pic2 title pic2 alt](/2021/03/14/hexo-3/pic2.jpg)