hugo new site ./
git init
git add *
git commit -m "Initial commit"cd themes/
git submodule add https://github.com/halogenica/beautifulhugo.git themes/beautifulhugo
git status
git add *
git commit -m "Theme added"
Some themes (Relearn) have to be downloaded as zip. So we have a git repo inside a git repo now. Copy contents exampleSite of theme:
cp -r themes/hugo-theme-relearn/exampleSite/* ./
Launch local web-server:
hugo server
Visit local site and check it.
Gitlab sync
Create a Gitlab account, make SSH Key exchange. After that, create project by CLI from hugo site folder:
git branch -m master main # change master to main branch for gitlabgit push --set-upstream git@gitlab.com:aagern/hugotest.git main
Where hugotest.git is the project name.
Click Setup CI/CD button.
Use Hugo template (should be in Gitlab):
---
# All available Hugo versions are listed here:# https://gitlab.com/pages/hugo/container_registry# image: "${CI_TEMPLATE_REGISTRY_HOST}/pages/hugo:latest"image:
name: "${CI_TEMPLATE_REGISTRY_HOST}/pages/hugo:latest" entrypoint: ["/bin/sh", "-c"]variables:
GIT_SUBMODULE_STRATEGY: recursive
test:
script:
- hugo
except:
variables:
- $CI_COMMIT_BRANCH==$CI_DEFAULT_BRANCHpages:
script:
- hugo
artifacts:
paths:
- public
only:
variables:
- $CI_COMMIT_BRANCH==$CI_DEFAULT_BRANCH environment: production
Change visibility: Settings -> General -> Pages visibility = Everyone.