Hugo Front matter
Step 1. Install Hugo
Go to Hugo releases and download the appropriate version for your OS and architecture.
$ hugo env
hugo v0.126.3+extended darwin/amd64 BuildDate=2024-06-02T13:02:43Z VendorInfo=brew
GOOS="darwin"
GOARCH="amd64"
GOVERSION="go1.22.3"
github.com/sass/libsass="3.6.5"
github.com/webmproject/libwebp="v1.3.2"
Step 2. Launch Example Site
Hugo has its own example site which happens to also be the documentation site you are reading right now.
Follow the following steps:
- Clone the Hugo repository
- Go into the repo
- Copy example site files
- Run hugo in server mode
- Open your browser to http://localhost:1313
Corresponding pseudo commands:
git clone https://github.com/twotwo/hugo-template
cd hugo-template
cp -r themes/cleanwhite/exampleSite/* .
hugo server --disableFastRender -D
Once you’ve gotten here, follow along the rest of this page on your local build.
Step 3. Change content
Stop the Hugo process by hitting Ctrl+C.
Here we export WordPress posts into content
- Remove example posts
- Export WP content to Markdown files, use this script
- Run hugo in server mode
Corresponding pseudo commands:
rm -rf content/posts
python wp2octopress.py wp_lixinyang localhost user password /tmp/hugo-template/content/posts /tmp/hugo-template/content/pages
hugo server --disableFastRender -D
Change and save this file.. Notice what happened in your terminal.
$ hugo server --disableFastRender -D
Watching for changes in /tmp/hugo-template/{archetypes,content,data,themes}
Watching for config changes in /tmp/hugo-template/hugo.yaml
Start building sites …
| EN
-------------------+-------
Pages | 1018
Paginator pages | 336
Non-page files | 0
Static files | 73
Processed images | 0
Aliases | 146
Cleaned | 0
Built in 859 ms
Refresh the browser and observe that the typo is now fixed.
Notice how quick that was. Try to refresh the site before it’s finished building. I double dare you. Having nearly instant feedback enables you to have your creativity flow without waiting for long builds.
Step 4. Publish Service
Generate static site in public
folder
$ hugo --minify --gc
$ rsync -avP public/* vps-server:local/path