Hugo
go开发的静态站点生成器.
https://github.com/gohugoio/hugo
搭建博客
创建环境:
# linux, ubuntu18.04默认是非extended, 19.04 默认extended。
$ sudo apt-get install hugo
# extended支持Sass/scss
$ sudo snap install hugo --channel=extended
# windows
PATH: C:\Hugo\bin\hugo.exe
测试安装:
$ hugo help
创建hugo项目:
$ cd /home/canux/sites
> cd C:\hugo\sites
$ hugo new site canuxcheng.com
生成下列文件和目录:
config.toml
archetypes
content # md 文件
data
layouts
static
themes
bytes
Theme
https://github.com/gohugoio/hugoThemes
下载所有主题:
cd blog
git clone --depth 1 --recursive https://github.com/gohugoio/hugoThemes.git themes
下载单个主题:
cd themes
git clone url
在config.toml添加主题:
theme = 'name'
themesDir = "/path/to/themes"
创建主题:
$ hugo new theme [name]
添加自己的主题:
$ git submodule add https://github.com/crazy-canux/hugo-theme-canux.git
克隆主题:
$ git submodule init
$ git submodule update
创建页面
## content/about.md
$ hugo new about.md
创建文章
## content/post/page.md
$ hugo new post/Shell.md
本地测试
$ hugo server --theme=hyde --buildDrafts
$ firefox http://localhost:1313
部署到github
先在github创建repo.
$ hugo --theme=<theme> --baseUrl="https://<user>.github.io/"
push到github:
$ cd public
$ git init
$ git remote add origin https://github.com/<user>/<user>.github.io.git
$ git add -A
$ git commit -m "first push."
$ git push -u origin master