Hugo extended on gitlab pages?

I’m trying to run a site through GitLab pages using Academic 4.6 theme, which requires Hugo Extended v0.58.3+, which I’m running locally.

It seems that GitLab pages has a problem with this, however.

My site fails in the CI pipeline. Here’s the error message

The pertinent bit (I think?):

ERROR 2019/11/26 14:37:43 Transformation failed: TOCSS: failed to transform "main_parsed.scss" (text/x-scss): this feature is not available in your current Hugo version, see https://goo.gl/YMrWcn for more information

But is the problem my Hugo version, or is it the version used by GitLab pages? Any help would be appreciated.

The one used by GitLab Pages.

Thanks for confirming.

Is there anything I can do about it, other than revert to Academic 4.5, which does not require Hugo Extended?

You could download the extended version of hugo in your CI script. I’m not familiar with GitLab Pages specifically but I’m guessing it’s possible. Steps would be something like:

  • download hugo extended tarball from github releases
  • un tar it
  • move it somewhere already on your PATH like /usr/local/bin
1 Like

Assuming you are following the “official” hugo gitlab pages example from https://gitlab.com/pages/hugo/blob/master/.gitlab-ci.yml you should be able to just switch the image to the extended one:

1 Like

The simplest solution would be for you to generate your project’s resources locally and then commit them in your repository.

This way your project will be published even if the basic version of Hugo is used during deployment.

Whenever you make changes to your assets you will again need to regenerate locally and then commit.

3 Likes

Thanks–this sounds right. In the config file, I set publishDir = "public/". Now when I run hugo locally, it generates the resources in that folder.

However, I think I need to change the .gitlab-ci.yml file so that gitlab pages serves from my /public/ (html) folder. Currently I have this:

# All available Hugo versions are listed here: https://gitlab.com/pages/hugo/container_registry
image: registry.gitlab.com/pages/hugo:latest

variables:
  GIT_SUBMODULE_STRATEGY: recursive

test:
  script:
  - hugo
  except:
  - master

pages:
  script:
  - hugo
  artifacts:
    paths:
    - public
  only:
  - master

I think I need something different, though. Any idea?

I have it working–maybe not the most efficient way. I copy the contents of the “public” folder into a separate repository (in github actually) and it works fine. Inelegant but at least I can stop messing around. Thanks everyone.