2018/6/23
Hexo
- mdファイルで書きたい
- できればgithubpage使いたい
Hexo
https://hexo.io/
Documentation | Hexo
https://hexo.io/docs/
$ npm install hexo-cli -g
$ hexo init blog
$ cd blog
$ npm install
$ hexo server
これまでのjekyllのと違ってpermalinkがファイル名を使ってたのでファイル名を
yyyy-mm-dd-title.md
から
title.md
に変更した
$ hexo server
http://localhost:4000/
で確認できる。
GithubPagesへデプロイ
Gitでデプロイするためにインストール
$ npm install hexo-deployer-git --save
config_yamlに設定を書く
deploy:
type: git
repo: [email protected]:mersy/mersy.github.io.git
branch: master
message: [message]
他のデプロイ先も選べるみたいでこれはなかなか便利かも。
Deployment | Hexo
https://hexo.io/docs/deployment.html
Atom用の拡張
MarkdownファイルはAtomで書くと思うのでひとまずインストール
atom-hexo
https://atom.io/packages/atom-hexo
コマンド(cmd-shift-P)
- hexo new # Create a new post
- hexo publish # Publish a draft post
- hexo generate # Generate static files
- hexo deploy # Generate static files and deploy
- hexo clean # Clean the cache file and generated files
下書き
$ hexo new
でdraftを作成する
_draft 以下に生成される。
$ hexo server --draft
でローカルで下書きが確認できる
新規作成時のテンプレート
- /scaffolds
- draft.md : ドラフト投稿用のテンプレート
- post.md : 投稿用のテンプレート
- page.md : 固定ページ用のテンプレート
JSONを作成する
このへんのプラグインがありそう。
- alexbruno/hexo-generator-json-feed
https://github.com/alexbruno/hexo-generator-json-feed - leviwheatcroft/hexo-generator-recent
https://github.com/leviwheatcroft/hexo-generator-recent - HeskeyBaozi/hexo-generator-to-json
https://github.com/HeskeyBaozi/hexo-generator-to-json - alexbruno/hexo-generator-json-content
https://github.com/alexbruno/hexo-generator-json-content
ひとまずは hexo-generator-json-feed を試してみている
highlightの無効化
コードを含む時にcode部分はシンプルにしたかったのでhighlightを無効にする
highlight:
enable: false
TODO
- カテゴリの設定
- 検索(flexibeSearch)
- 引用のデザイン
参考リンク
- atom-hexo
https://atom.io/packages/atom-hexo - Hexo と GitHub Pages でブログ環境を構築して公開する - Qiita
http://qiita.com/bird_tummy/items/5988a1efe47e0d47132b - Hexoで始めるお手軽な静的ブログ -画像投稿とプラグインの追加- - Qiita
http://qiita.com/in_silico_/items/31c2c0bc1cf061c86250 - Hexo の 新規投稿テンプレート を カスタマイズ | 験なきものを思はずは
https://azriton.github.io/2016/11/04/Hexoの新規投稿テンプレートをカスタマイズ/