Table of Contents
1 hexo
- install hexo
npm install -g hexo
- generate static webpage
hexo g
- run local server
hexo s
- deploy to github
hexo d -g
1.1 config
modify your _config.yml or create my_config.yml according offical manual
1.2 theme
There is many great themes available. I like TKL the most.
After download theme, change theme
to maupassant
in root _config.yml. Also theme's _config.yml can be modified.
TKL
1
2
3git clone https://github.com/SuperKieran/TKL.git themes/TKL
cd themes/TKL
git pullmaupassant
If encounter error while install sass, use taobao.
1
2
3
4git clone https://github.com/tufu9441/maupassant-hexo.git themes/maupassant
npm install hexo-renderer-jade --save
npm install -g cnpm --registry=http://registry.npm.taobao.org
cnpm install hexo-renderer-sass --saveair
1
2
3
4git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia
# Update from github
cd themes/yilia
git pull
1.3 github
Modify
deploy
in _config.yml according to next lines.1
2
3
4deploy:
type: git
repo: https://github.com/angry-bird/angry-bird.github.io.git
branch: masterDeploy local repo to github.
1
2
3
4
5
6npm i --save hexo-deployer-git
git remote add origin https://github.com/angry-bird/angry-bird.github.io.git
# git remote add origin git@github.com:angry-bird/angry-bird.github.io.git
git checkout -b source
git push origin source
hexo g -dDeploy on both coing and github
1
2
3
4
5
6
7deploy:
- type: git
repo: https://github.com/angry-bird/angry-bird.github.io.git
branch: master
- type: git
repo: https://git.coding.net/zuoshi/angry-bird.github.io.git
branch: master1
2
3
4
5deploy:
type: git
repo:
github: git@github.com:angry-bird/angry-bird.github.io.git, master
coding: git@git.coding.net:zuoshi/zuoshi.git, master- connecting-to-github-with-ssh
1.4 hexo-renderer-org
Install hexo-renderer-org
1
npm install https://github.com/MephistoMMM/hexo-renderer-org.git --save
1
2### Outdated
npm install https://github.com/CodeFalling/hexo-renderer-org#emacs --saveModify root _config.yml
1
2
3
4
5
6
7
8
9org:
emacs: '/usr/local/Cellar/emacs-plus/26.1/Emacs.app/Contents/MacOS/Emacs'
emacsclient: '/usr/local/Cellar/emacs-plus/26.1/bin/emacsclient'
common: |
#+OPTIONS: toc:1 num:2 ^:{} creator:nil author:nil email:nil date:nil timestamp:nil
#+BIND: org-html-validation-link nil
line_number: true
cachedir: './hexo-org-cache/'
daemonize: trueMisc
Setting caption of image1
2#+ATTR_HTML: :alt caption
[[image url]]Add Read more button,
insert before first headline, and Table of Contents will be fine.
1
2
3#+BEGIN_EXPORT html
<!--more-->
#+END_EXPORT
1.5 plugins
- plugins like sitemap, feed/rss, about, disqus/gitalk
about.html will generated from
source/about.md
1
2npm install hexo-generator-sitemap -save
npm install hexo-generator-feed -save- all plugins will generate to public/
- Disqus/duoshuo/Gitalk, but
duoshuo
is not available since July 2017,Gitalk
is the substitution.- disqus shortname
install gitalk
1
npm i --save gitalk
1
2import 'gitalk/dist/gitalk.css'
import Gitalk from 'gitalk'-
1
2
3
4
5
6
7
8
9var gitalk = new Gitalk({
clientID: 'your-client-id',
clientSecret: 'your-client-secret',
repo: 'angry-bird.github.io',
owner: 'angry-bird',
admin: ['angry-bird'],
})
gitalk.render('gitalk-container')Note that
application name
set asgitalk
,homepage url
is your blog's domain url, andauthorization callback url
is blog's github address. After that, copyClient ID
andClient Secret
,repo
isowner
.github.io - theme's _config.yml
1.6 widges on theme TKL
- widges like weibo, facebook, search, category, tagcloud
baidustatic
1
2
3
4
5
6
7
8
9<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?c65795c17436c80c4127ae64076e5746";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
2 blog-admin
1 | (add-hook 'blog-admin-backend-after-new-post-hook 'find-file) |
3 other options
3.1 org-page
- melpa install package, but failed because incompatible dependency packages
- config repo and site
- publish