Git
和Node
hexo
GitHub
,建立一個倉庫,庫名格式爲:GitHub用戶名.github.io
Git
Node
hexo
//安裝hexo
&:npm install hexo-cli -g //建立本地博客,「GitHub用戶名.github.io」建議和GieHub倉庫名一致 hexo init GitHub用戶名.github.io 例如: &:hexo init 1170197998.github.io //進入到安裝目錄 &:cd 1170197998.github.io/ //安裝npm &:npm install //啓動服務 &;hexo server
npm install hexo-server --save npm install hexo --save
1170197998.github.io
的倉庫,1170197998.github.io
中的_config.yml
,加入倉庫地址,以下:deploy: type: git repo: https://github.com/1170197998/1170197998.github.io.git branch: master
public
文件夾),部署服務//生成靜態文件 &:hexo generate //部署服務 &:hexo deploy
1170197998.github.io
能夠訪問博客
github
空間服務IP
:ping 1170197998.github.io
source
文件下新建一個文件名爲CNAME
文件,不要有後綴,輸入域名,保存關閉hexo g
,hexo d
進行生成和部署。此時在瀏覽地址欄鍵入域名就能夠打開博客了themes
文件夾下,默認landscape
主題,想切換別的主題,終端進入到該文件夾下,進行克隆便可,好比克隆next主題:&:git clone https://github.com/iissnan/hexo-theme-next themes/next
_config.yml
中把theme
的值由默認的landscape
修改成next
。hexo g
,hexo d
進行生成和部署命令。此時再登陸域名,主題已經切換。1170197998.github.io
,網頁加載完後會變爲url
的值,而後執行hexo g
,hexo d
進行生成和部署命令。npm install hexo -g #安裝 npm update hexo -g #升級 hexo init #初始化 簡寫 hexo n "個人博客" == hexo new "個人博客" #新建文章 hexo p == hexo publish hexo g == hexo generate#生成 hexo s == hexo server #啓動服務預覽 hexo d == hexo deploy#部署 服務器 hexo server 會監視文件變更並自動更新,無須重啓服務器。 hexo server -s #靜態模式 hexo server -p 5000 #更改端口 hexo server -i 192.168.1.1 #自定義 IP hexo clean #清除緩存 網頁正常狀況下能夠忽略此條命令,清除了db_json文件和public文件夾 hexo g #生成靜態網頁 hexo d #開始部署 監視文件變更 hexo generate #使用 Hexo 生成靜態文件快速並且簡單 hexo generate --watch #監視文件變更 完成後部署 hexo generate --deploy hexo deploy --generate or: hexo deploy -g hexo server -g 草稿 hexo publish [layout] <title>
FATAL Cannot find module '/Users/xxxxxxx/GitHubBlog/1170197998.github.io/node_modules/hexo-renderer-marked' Error: Cannot find module '/Users/xxxxxxx/GitHubBlog/1170197998.github.io/node_modules/hexo-renderer-marked' at Function.Module._resolveFilename (module.js:485:15) at Function.resolve (internal/module.js:18:19)
npm install
,執行以下命令:&:rm -rf node_modules
&:npm install
先執行:
npm install hexo-deployer-git --save 而後執行: hexo g hexo d
在文章的頂部tags和categories中這樣寫所屬分類和對應的標籤,例如:css
tags: [iOS,鏈式編程和函數式編程] categories: [iOS_Objective-C] 備註:單個分類或者標籤不須要用中括號[],多個的時候用[]括起來,英文逗號隔開。
使用的是Local Search
, 首先安裝hexo-generator-searchdb
<要在當前博客目錄下>html
npm install hexo-generator-searchdb --save
而後在博客目錄下的_config.xml
裏面加入如下字段node
search:
path: search.xml
field: post format: html limit: 10000
同時要把主題目錄下的_config.xml
文件中的local_search
的enable
設置爲truegit
local_search:
enable: true
註冊登陸百度統計,把統計腳本id複製到主題next
下的配置文件_config.xml
中的baidu_analytics
字段後
github
註冊登陸網易雲跟帖,將yunTieProductKey
放到主題next
下的配置文件_config.xml
中的gentie_productKey
字段後
npm