Install Hugo
Environment
- Debian 9.5 x64
- Go 1.9.7
- Hugo 0.51-DEV-2BD9D909
Excerpt
- https://www.digitalocean.com/community/tutorials/how-to-install-and-use-hugo-a-static-site-generator-on-ubuntu-14-04
- https://gohugo.io/documentation/
- https://themes.gohugo.io
Pre-requisite Install Go
Log 2018 / 11
1. Install Hugo
root@athos:~# apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
root@athos:~# go get github.com/magefile/mage
root@athos:~# go get -d github.com/gohugoio/hugo
root@athos:~# cd ${GOPATH:-$HOME/go}/src/github.com/gohugoio/hugo
root@athos:~/.gvm/pkgsets/go1.9.7/global/src/github.com/gohugoio/hugo# mage vendor
root@athos:~/.gvm/pkgsets/go1.9.7/global/src/github.com/gohugoio/hugo# mage install
root@athos:~# hugo version
Hugo Static Site Generator v0.51-DEV-2BD9D909 linux/amd64 BuildDate: 2018-11-04T05:37:24Z
2. Hugo gen autocomplete
root@athos:~# hugo gen autocomplete
Bash completion file for Hugo saved to /etc/bash_completion.d/hugo.sh
3. Hugo new site
root@athos:~# hugo new site athos
Congratulations! Your new Hugo site is created in /root/athos.
Just a few more steps and you're ready to go:
1. Download a theme into the same-named folder.
Choose a theme from https://themes.gohugo.io/, or
create your own with the "hugo new theme <THEMENAME>" command.
2. Perhaps you want to add some content. You can add single files
with "hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>".
3. Start the built-in live server via "hugo server".
Visit https://gohugo.io/ for quickstart guide and full documentation.
root@athos:~# ls -lF athos/
total 28
drwxr-xr-x 2 root root 4096 Nov 4 05:44 archetypes/
-rw-r--r-- 1 root root 82 Nov 4 05:44 config.toml
drwxr-xr-x 2 root root 4096 Nov 4 05:44 content/
drwxr-xr-x 2 root root 4096 Nov 4 05:44 data/
drwxr-xr-x 2 root root 4096 Nov 4 05:44 layouts/
drwxr-xr-x 2 root root 4096 Nov 4 05:44 static/
drwxr-xr-x 2 root root 4096 Nov 4 05:44 themes/
4. Configure Theme
root@athos:~# cd athos/
git clone \
https://github.com/nodejh/hugo-theme-cactus-plus.git themes/hugo-theme-cactus-plus
root@athos:~/athos# git clone \
> https://github.com/nodejh/hugo-theme-cactus-plus.git themes/hugo-theme-cactus-plus
Cloning into 'themes/hugo-theme-cactus-plus'...
remote: Enumerating objects: 713, done.
remote: Total 713 (delta 0), reused 0 (delta 0), pack-reused 713
Receiving objects: 100% (713/713), 2.17 MiB | 953.00 KiB/s, done.
Resolving deltas: 100% (371/371), done.
root@athos:~/athos# cp -r themes/hugo-theme-cactus-plus/exampleSite/* .
5. Hugo server
hugo server --bind=0.0.0.0 --port=80 \
--baseURL=http://athos.host/
root@athos:~/athos# hugo server --bind=0.0.0.0 --port=80 \
> --baseURL=http://athos.host/
| EN
+------------------+----+
Pages | 31
Paginator pages | 0
Non-page files | 0
Static files | 26
Processed images | 0
Aliases | 1
Sitemaps | 1
Cleaned | 0
Total in 62 ms
Watching for changes in /root/athos/{content,data,layouts,static,themes}
Watching for config changes in /root/athos/config.toml
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://athos.host:80/ (bind address 0.0.0.0)
Press Ctrl+C to stop
6. Hugo Publish
root@athos:~/athos# hugo --baseURL=http://athos.host/
| EN
+------------------+----+
Pages | 31
Paginator pages | 0
Non-page files | 0
Static files | 26
Processed images | 0
Aliases | 1
Sitemaps | 1
Cleaned | 0
Total in 54 ms
root@athos:~/athos# ls -lF public/
total 56
-rw-r--r-- 1 root root 3282 Nov 4 05:53 404.html
drwxr-xr-x 2 root root 4096 Nov 4 05:53 about/
drwxr-xr-x 4 root root 4096 Nov 4 05:53 categories/
drwxr-xr-x 2 root root 4096 Nov 4 05:49 css/
drwxr-xr-x 2 root root 4096 Nov 4 05:49 fonts/
drwxr-xr-x 2 root root 4096 Nov 4 05:49 images/
-rw-r--r-- 1 root root 5429 Nov 4 05:53 index.html
-rw-r--r-- 1 root root 2726 Nov 4 05:53 index.xml
drwxr-xr-x 2 root root 4096 Nov 4 05:49 js/
drwxr-xr-x 3 root root 4096 Nov 4 05:53 page/
drwxr-xr-x 6 root root 4096 Nov 4 05:53 posts/
-rw-r--r-- 1 root root 2439 Nov 4 05:53 sitemap.xml
drwxr-xr-x 8 root root 4096 Nov 4 05:53 tags/