Whatever is worth doing is worth doing well.
曾經(jīng)用過新浪博客,網(wǎng)速慢,用著不舒服,正好這幾天有時間,下定決心利用github這個平臺搭建自己的博客。第一篇不寫自己,只把參考的文章分享一下以表敬意。
一、參考的文章
(1)以下任意一篇做下來都可以成功,輔助看可以加深理解,相輔相成。
(2)搭建好后就可以發(fā)博客了
(3)然后可以選擇自己喜歡的主題換上
二、幾個常用的命令
(1)關于主題
- 下載主題(例fexo,下載地址為https://github.com/forsigner/fexo.git)
cd c
cd Hexo
git clone https://github.com/forsigner/fexo.git
- 更換主題
手動更換:打開Hexo/_config.yml,找到theme,改為theme: fexo , 找到language: english,將zh-CN改為下載的主題下對應的zh-CN或zh-Hans
- 更新主題到博客
hexo clean
hexo generate
hexo deploy
(2)關于發(fā)博客
- 生成新文章
hexo new "新的文章標題"
在Hexo\source_posts文件下有新生成的新的文章標題.md,語法是markdown,簡直不要太好用!用一次就上癮了,語法簡單,入門輕松!
- 編輯好后就可以更新了,同上面的命令
hexo clean
hexo generate
hexo deploy
(3)更換電腦后如何更新博客
- 將文件復制到本地
根目錄在E盤
git clone https://github.com/2016lkaust/2016lkaust.github.io.git
- 進入文件夾
cd 2016lkaust.github.io
- 安裝hexo,不需要初始化了
npm install hexo
npm install
npm install hexo-deployer-git
此時就會出現(xiàn)一個新的文件夾Hexo
然后按照上面寫博客的方式寫就行了。
- 提交修改可以用以下方法
git add <文件名>/*
git commit -m "信息"
git push origin Hexo
如下圖:第一次出錯了,寫成了hexo。
(4)關于markdown
- 插入本地圖片
首先確認 _config.yml 中有 <font color=red>post_asset_folder:true</font> 。
在 hexo 目錄,執(zhí)行
<table><td bgcolor="silver">
npm install https://github.com/CodeFalling/hexo-asset-image --save
</td></table>
假設在
我的第一篇博客(文件夾)
├── apppicker.jpg
├── logo.jpg
└── rules.jpg
我的第一篇博客.md
這樣的目錄結構(目錄名和文章名一致),只要使用

就可以插入圖片。
- 自定義字體顏色
<font color=red>這是效果顏色</font>
效果:<font color=red>這是效果顏色</font>
-自定義背景顏色
<table><td bgcolor=#F0F0F0>背景顏色是#F0F0F0</td></table>
效果:<table><td bgcolor=#F0F0F0>背景顏色是#F0F0F0</td></table>
就這樣,博客搭建完畢,第一篇博文發(fā)表。從昨天中午到今天傍晚,終于稍稍入門了。以后將常駐這里了。
centos使用hexo
CentOS 7下手把手搭建hexo博客
安裝
centos 使用 nvm 安裝 nodejs
Centos Git1.7.1升級到Git2.2.1
centos 6.7 安裝 最新版 git
-bash: hexo: command not found解決辦法
[root@localhost hexo]# hexo
ERROR Script load failed: themes/next/scripts/tags/exturl.js
Error: Cannot find module 'hexo-util'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (/opt/blog/hexo/node_modules/hexo/lib/hexo/index.js:214:21)
at /opt/blog/hexo/themes/next/scripts/tags/exturl.js:7:12
at /opt/blog/hexo/node_modules/hexo/lib/hexo/index.js:230:12
at tryCatcher (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:693:18)
at Promise._fulfill (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:638:18)
at Promise._resolveCallback (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:432:57)
at Promise._settlePromiseFromHandler (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:524:17)
at Promise._settlePromise (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:693:18)
at Promise._fulfill (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:638:18)
at /opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/nodeback.js:42:21
at /opt/blog/hexo/node_modules/hexo/node_modules/hexo-fs/node_modules/graceful-fs/graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
Usage: hexo <command>
npm install hexo-util --save
? centos hexo d ERROR Deployer not found: git
npm install hexo-deployer-git --save