I'm using the Hugo framework to deploy GitLab pages. As described in another post, it seems to be possible to publish pages for multiple branches.
I tried to integrate the code provided in the post, but it doesn't work.
My original gitlab-ci.yml
looks like:
image: registry.gitlab.com/pages/hugo/hugo_extended:latest
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
- apk add --update --no-cache git
test:
script:
- hugo --gc --minify
except:
- master
pages:
script:
- hugo --gc --minify
artifacts:
paths:
- public
only:
- master
Is it possible, to deploy pages for every branch when using hugo? What do i need to change to achieve this?
Below solution, from GitLab Pages per branch : the no-compromise hack to serve preview pages, works with Hugo or any generating framework.
You can then have these features :
main
content is exposed on$CI_PAGES_URL
and the path is configurable with$CURRENT_CONTENT_PATH
$CI_PAGES_URL/preview
, with a homepage to easily navigate to branches content$EPHEMERAL_BRANCHES_PATH
variable to hide preview content by obfuscationpages
foldermain
content has not been generated in current cache, or if the cache has been deleted, an error is triggered, to avoid accidental deletionworkflow:rules
can be deleted if you already have your own, or updated to match your flowpages
and the artifact must be apublic
folder to be deployed to GitLab Pages (or you can use the pages:publish keyword)