Clone repo in Codespaces
Add Hugo devcontainer
- Click the “Codespaces” button in the bottom-left corner of Visual Studio Code
- Click “Add Development Container Configuration Files”
- Click “Show All Definitions”
- Click “Hugo (Community)”
- Click “OK”
Create new hugo site:
1
>hugo new site blog
Try to create new hugo module https://docs.stack.jimmycai.com/getting-started
1 2
>hugo mod init github.com/achingono/achingono.github.io Error: failed to init modules: binary with name "go" not found
Add go binary to devcontainer docker file
1 2 3 4 5 6 7 8 9 10
# GO version ARG GO_VERSION=18 #Download Go RUN wget https://golang.org/dl/go1.${GO_VERSION}.linux-amd64.tar.gz && \ tar -C /usr/local -xzf go1.${GO_VERSION}.linux-amd64.tar.gz && \ rm go1.${GO_VERSION}.linux-amd64.tar.gz ENV GOPATH /go ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
Check go version
1 2
>go version go version go1.18 linux/amd64
Turn new site into a Hugo module:
1 2 3 4
>hugo mod init github.com/achingono/achingono.github.io go: creating new go.mod: module github.com/achingono/achingono.github.io go: to add module requirements and sums: go mod tidy
Declare the hugo-theme-stack module as a dependency of your site:
1 2 3 4
>hugo mod get github.com/CaiJimmy/hugo-theme-stack/v3 go: downloading github.com/CaiJimmy/hugo-theme-stack/v3 v3.10.0 go: downloading github.com/CaiJimmy/hugo-theme-stack v2.6.0+incompatible go: added github.com/CaiJimmy/hugo-theme-stack/v3 v3.10.0
Grab config file from example site
1
>wget https://raw.githubusercontent.com/CaiJimmy/hugo-theme-stack/master/exampleSite/config.yaml
Update
config.yaml
file
|
|
- Delete
config.toml
file - Create new post
- Run
hugo server -D
- Browse to
http://127.0.0.1:1313