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 :
maincontent is exposed on$CI_PAGES_URLand the path is configurable with$CURRENT_CONTENT_PATH$CI_PAGES_URL/preview, with a homepage to easily navigate to branches content$EPHEMERAL_BRANCHES_PATHvariable to hide preview content by obfuscationpagesfoldermaincontent has not been generated in current cache, or if the cache has been deleted, an error is triggered, to avoid accidental deletionworkflow:rulescan be deleted if you already have your own, or updated to match your flowpagesand the artifact must be apublicfolder to be deployed to GitLab Pages (or you can use the pages:publish keyword)