Hugoを使ってみた
Hugo :: A fast and modern static website engine
brew install hugo hugo new site /path/to/site cd /path/to/site hugo new post/start.md git clone --recursive https://github.com/spf13/hugoThemes themes hugo server --buildDrafts --theme=nofancy
テーマはシンプルなnofancyがよかった。
hugo new & edit with vim
hugo new post/edit-with-vim.md --editor=vim
watch mode
hugo server --watch
Syntax highlighting
- themeのheaderをカスタマイズして、highlight.jsを入れる
- テーマのファイルをコピーして/layoutsへ入れればこちらが優先される仕組みっぽい
cp themes/nofancy/layouts/partials/header.html layouts/partials/
</head>
の前あたりに入れる- カラースキーマのライブプレビュー
- https://highlightjs.org/static/demo/
<link rel="stylesheet" href="https://yandex.st/highlightjs/8.0/styles/default.min.css"> <script src="https://yandex.st/highlightjs/8.0/highlight.min.js"></script> <script> hljs.configure({ tabReplace: " " }); hljs.initHighlightingOnLoad(); </script>
- VimscriptとGoのハイライトが標準のhighlight.jsに入ってないぽいのでカスタマイズしてダウンロード
- https://highlightjs.org/download/
mkdir static/{css,js} cp ~/Downloads/highlight/highlight.pack.js ./static/js/ cp ~/Downloads/highlight/styles/hybrid.css ./static/css/
<script src="{{ .Site.BaseUrl }}/js/highlight.pack.js"></script> <link rel="stylesheet" href="{{ .Site.BaseUrl }}/css/hybrid.css"> <script> hljs.configure({ tabReplace: " " }); hljs.initHighlightingOnLoad(); </script>
Hosting on Github pages
- http://gohugo.io/tutorials/github-pages-blog/
- username.github.io-hugoリポジトリに本体を入れて、publicをusername.github.ioのサブモジュールにするようにしてる方法など。
gitのorphanブランチを知った。 元のブランチから歴史を引き継がずに新しく歴史を始めることができる。
git checkout --orphan <new_branch> git rm -rf . git add 新しいファイル git commit