Need help to set up the youtube hugo module on gitlab pages

Hi !

I’m hosting my website on gitlab pages. It uses hugo 140.2.

I just saw the deprecation of container registry in the docs and changed my .gitlab-ci.yaml accordingly.

I needed a newer version of hugo because one of my modules need a minimal version 141. I was using the module before and it worked but I needed a new functionality and thus updated the modules.

Now everything is still working locally (with hugo 0.151.0) but the youtube module is broken on the online version.

(note that the gitlab version I use hugo 145 because I still need to fix my css to adapt to changes from hugo 146).

Can you help me understand why the youtube hugo module is not working on my gitlab pages setup ?

Here’s my .gitlab-ci.yaml

default:
  image: hugomods/hugo:exts-0.145.0
#  image: "${CI_TEMPLATE_REGISTRY_HOST}/pages/hugo/hugo_extended:latest"

variables:
  GIT_SUBMODULE_STRATEGY: recursive
  HUGO_ENV: production

before_script:
  - apk add --no-cache go curl bash nodejs
  ## Uncomment the following if you use PostCSS. See https://gohugo.io/hugo-pipes/postcss/
  # - npm install postcss postcss-cli autoprefixer

test:
  script:
    - hugo
  rules:
    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH

pages:
  script:
    - hugo
  artifacts:
    paths:
      - public
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  environment: production

My hugo.toml includes

[module]
  [[module.imports]]
    path = "github.com/davidsneighbour/hugo-modules/modules/youtube"

go.mod

module gitlab.com/kulusesouriant/website

go 1.21.10

require (
	github.com/davidsneighbour/hugo-modules/modules/youtube v1.2025.0 // indirect
	github.com/paulirish/lite-youtube-embed v0.3.3 // indirect
)

go.sum

github.com/davidsneighbour/hugo-modules/modules/youtube v1.2025.0 h1:4HTOtKJD0W0EuzJ3bAs1dp9OVfY7iwNNvUfDrDtgFv8=
github.com/davidsneighbour/hugo-modules/modules/youtube v1.2025.0/go.mod h1:uOBVhplKlCsYLRr4HW91llkT21eQ2ccn8ajdj+0kQBI=
github.com/paulirish/lite-youtube-embed v0.3.3 h1:AP8TnWs7WZGe3Svuhfl+RMsFk7by6z6D3mhWFsY3cR0=
github.com/paulirish/lite-youtube-embed v0.3.3/go.mod h1:9nuUWCzbFF/vvl3ClpZ1KsYFi/hlKjVOkmG8E+nsGDY=

Here are the build logs from gitlab. No mention of the youtube hugo module

Running with gitlab-runner 18.4.0~pre.115.gb2218bab (b2218bab)
  on blue-5.saas-linux-small-amd64.runners-manager.gitlab.com/default -AzERasQr, system ID: s_4cb09cee29e2
Preparing the "docker+machine" executor 00:24
Using Docker executor with image hugomods/hugo:exts-0.141.0 ...
Using effective pull policy of [always] for container hugomods/hugo:exts-0.141.0
Pulling docker image hugomods/hugo:exts-0.141.0 ...
Using docker image sha256:7da225084e7baa272668bf40cb83c35631ccb629e879ea690687ee2db469252e for hugomods/hugo:exts-0.141.0 with digest hugomods/hugo@sha256:19ec4038c7cedbe4bbf36365eea610d844ea378b105cb038a2ec37c8d63d2274 ...
Preparing environment 00:00
Using effective pull policy of [always] for container sha256:f02c4b945eda1247f6a9264360fca8b780858833686997274a58d71a6cf30b2b
Running on runner--azerasqr-project-61737769-concurrent-0 via runner-azerasqr-s-l-s-amd64-1759935162-ddd3a76b...
Getting source from Git repository 00:03
Gitaly correlation ID: 3eb36531fc2a463e8e6c12ed94a626a4
Fetching changes with git depth set to 20...
Initialized empty Git repository in /builds/kulusesouriant/website/.git/
Created fresh repository.
Checking out e2c33c18 as detached HEAD (ref is master)...
Updating/initializing submodules recursively with git depth set to 20...
Submodule 'themes/hugo-cloak-email' (https://github.com/martignoni/hugo-cloak-email.git) registered for path 'themes/hugo-cloak-email'
Submodule 'themes/hugo-coder' (https://github.com/luizdepra/hugo-coder.git) registered for path 'themes/hugo-coder'
Synchronizing submodule url for 'themes/hugo-cloak-email'
Synchronizing submodule url for 'themes/hugo-coder'
Cloning into '/builds/kulusesouriant/website/themes/hugo-cloak-email'...
Cloning into '/builds/kulusesouriant/website/themes/hugo-coder'...
Submodule path 'themes/hugo-cloak-email': checked out '19e0284810127d1d56e2d813a311b0bd73bba96c'
Submodule path 'themes/hugo-coder': checked out '6bc00595434affd85e9d55af98779460de6fb1cd'
Updated submodules
Synchronizing submodule url for 'themes/hugo-cloak-email'
Synchronizing submodule url for 'themes/hugo-coder'
Entering 'themes/hugo-cloak-email'
Entering 'themes/hugo-coder'
Entering 'themes/hugo-cloak-email'
Entering 'themes/hugo-coder'
$ git remote set-url origin "${CI_REPOSITORY_URL}" || echo 'Not a git repository; skipping'
Executing "step_script" stage of the job script 00:09
Using effective pull policy of [always] for container hugomods/hugo:exts-0.141.0
Using docker image sha256:7da225084e7baa272668bf40cb83c35631ccb629e879ea690687ee2db469252e for hugomods/hugo:exts-0.141.0 with digest hugomods/hugo@sha256:19ec4038c7cedbe4bbf36365eea610d844ea378b105cb038a2ec37c8d63d2274 ...
$ apk add --no-cache go curl bash nodejs
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/community/x86_64/APKINDEX.tar.gz
(1/24) Upgrading musl (1.2.5-r8 -> 1.2.5-r9)
(2/24) Installing ncurses-terminfo-base (6.5_p20241006-r3)
(3/24) Installing libncursesw (6.5_p20241006-r3)
(4/24) Installing readline (8.2.13-r0)
(5/24) Installing bash (5.2.37-r0)
Executing bash-5.2.37-r0.post-install
(6/24) Upgrading libcurl (8.11.1-r0 -> 8.14.1-r2)
(7/24) Installing curl (8.14.1-r2)
(8/24) Installing jansson (2.14-r4)
(9/24) Installing binutils (2.43.1-r3)
(10/24) Installing libgomp (14.2.0-r4)
(11/24) Installing libatomic (14.2.0-r4)
(12/24) Installing isl26 (0.26-r1)
(13/24) Installing mpfr4 (4.2.1-r0)
(14/24) Installing mpc1 (1.3.1-r1)
(15/24) Installing gcc (14.2.0-r4)
(16/24) Installing musl-dev (1.2.5-r9)
(17/24) Installing go (1.23.9-r0)
(18/24) Installing ada-libs (2.9.2-r1)
(19/24) Installing icu-data-en (74.2-r1)
Executing icu-data-en-74.2-r1.post-install
*
* If you need ICU with non-English locales and legacy charset support, install
* package icu-data-full.
*
(20/24) Installing icu-libs (74.2-r1)
(21/24) Installing simdjson (3.10.1-r0)
(22/24) Installing simdutf (5.6.3-r0)
(23/24) Installing sqlite-libs (3.48.0-r4)
(24/24) Installing nodejs (22.15.1-r0)
Executing busybox-1.37.0-r9.trigger
OK: 664 MiB in 63 packages
$ hugo
hugo: collected modules in 1051 msStart building sites … 
hugo v0.141.0-e7bd51698e5c3778a86003018702b1a7dcb9559a+extended linux/amd64 BuildDate=2025-01-16T13:11:18Z VendorInfo=hugomods
WARN  Raw HTML omitted while rendering "/builds/kulusesouriant/website/content/fr/contact.md"; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe
You can suppress this warning by adding the following to your site configuration:
ignoreLogs = ['warning-goldmark-raw-html']
WARN  Raw HTML omitted while rendering "/builds/kulusesouriant/website/content/en/contact.md"; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe
You can suppress this warning by adding the following to your site configuration:
ignoreLogs = ['warning-goldmark-raw-html']
                   | FR | EN  
-------------------+----+-----
  Pages            | 69 | 67  
  Paginator pages  | 12 | 12  
  Non-page files   |  0 |  0  
  Static files     | 22 | 22  
  Processed images |  0 |  0  
  Aliases          |  4 |  3  
  Cleaned          |  0 |  0  
Total in 1720 ms
Uploading artifacts for successful job 00:02
Uploading artifacts...
public: found 362 matching artifact files and directories 
Uploading artifacts as "archive" to coordinator... 201 Created  correlation_id=1568b3736b594aceae5d57516f091b48 id=11648359457 responseStatus=201 Created token=6b_k-g2ik
Cleaning up project directory and file based variables 00:00
Job succeeded

First, I would use the GitLab Pages workflow from the Hugo documentation. This has been thoroughly tested and does not depend on a third-party container.

Second, the modules you reference were not created, nor are they maintained, by the Hugo project team. Please contact the module author.

a lot of version numbers for hugo…

finally the gitlab log states 0.141.0 but you expect 145? andl locally all is fine in 151?..

if I where you I would follow the advice with the documented workflow.

and make sure you use same versions incl. go as for your local run. always good for reliable builds.

spot the differences and investigate build logs loglevel debug and target pages or report

what about the RAW html omitted warning?

First of all thank you very much both of you for pointing me to the right GitLab Pages Workflow.

I changed the .gitlab-ci.yml accordingly but the youtube module still doesn’t work.

Here it is

variables:
  # Application versions
  DART_SASS_VERSION: 1.93.2
  HUGO_VERSION: 0.145.0
  NODE_VERSION: 22.18.0
  # Git
  GIT_DEPTH: 0
  GIT_STRATEGY: clone
  GIT_SUBMODULE_STRATEGY: recursive
  # Time zone
  TZ: Europe/Oslo

image:
  name: golang:1.25.1-bookworm

pages:
  stage: deploy
  script:
    # Create directory for user-specific executable files
    - echo "Creating directory for user-specific executable files..."
    - mkdir -p "${HOME}/.local"

    # Install utilities
    - echo "Installing utilities..."
    - apt-get update
    - apt-get install -y brotli xz-utils zstd

    # Install Dart Sass
    - echo "Installing Dart Sass ${DART_SASS_VERSION}..."
    - curl -sLJO "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
    - tar -C "${HOME}/.local" -xf "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
    - rm "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
    - export PATH="${HOME}/.local/dart-sass:${PATH}"

    # Install Hugo
    - echo "Installing Hugo ${HUGO_VERSION}..."
    - curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
    - mkdir "${HOME}/.local/hugo"
    - tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
    - rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
    - export PATH="${HOME}/.local/hugo:${PATH}"

    # Install Node.js
    - echo "Installing Node.js ${NODE_VERSION}..."
    - curl -sLJO "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz"
    - tar -C "${HOME}/.local" -xf "node-v${NODE_VERSION}-linux-x64.tar.xz"
    - rm "node-v${NODE_VERSION}-linux-x64.tar.xz"
    - export PATH="${HOME}/.local/node-v${NODE_VERSION}-linux-x64/bin:${PATH}"

    # Verify installations
    - echo "Verifying installations..."
    - "echo Dart Sass: $(sass --version)"
    - "echo Go: $(go version)"
    - "echo Hugo: $(hugo version)"
    - "echo Node.js: $(node --version)"
    - "echo brotli: $(brotli --version)"
    - "echo xz: $(xz --version)"
    - "echo zstd: $(zstd --version)"

    # Install Node.js dependencies
    - echo "Installing Node.js dependencies..."
    - "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci --prefer-offline || true"

    # Configure Git
    - echo "Configuring Git..."
    - git config core.quotepath false

    # Build site
    - echo "Building site..."
    - hugo --gc --minify --baseURL "${CI_PAGES_URL}"

    # Compress published files
    - echo "Compressing published files..."
    - find public/ -type f -regextype posix-extended -regex '.+\.(css|html|js|json|mjs|svg|txt|xml)$' -print0 > files.txt
    - time xargs --null --max-procs=0 --max-args=1 brotli --quality=10 --force --keep < files.txt
    - time xargs --null --max-procs=0 --max-args=1 gzip -9 --force --keep < files.txt
  artifacts:
    paths:
      - public
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

Here are the pipeline logs

Running with gitlab-runner 18.4.0~pre.115.gb2218bab (b2218bab)
  on blue-3.saas-linux-small-amd64.runners-manager.gitlab.com/default zxwgkjAPH, system ID: s_d5d3abbdfd0a
Preparing the "docker+machine" executor 00:20
Using Docker executor with image golang:1.25.1-bookworm ...
Using effective pull policy of [always] for container golang:1.25.1-bookworm
Pulling docker image golang:1.25.1-bookworm ...
Using docker image sha256:80d0c273b68be554ca551c61b4a22ef66baae074f3a9562636139ba01972e5b1 for golang:1.25.1-bookworm with digest golang@sha256:c423747fbd96fd8f0b1102d947f51f9b266060217478e5f9bf86f145969562ee ...
Preparing environment 00:03
Using effective pull policy of [always] for container sha256:751a6f0ec9e2dbd89d056fdc53c38823e9cbf94b94e595cfb7b5fd613e20e91f
Running on runner-zxwgkjaph-project-61737769-concurrent-0 via runner-zxwgkjaph-s-l-s-amd64-1759955067-fb5cebfe...
Getting source from Git repository 00:03
Gitaly correlation ID: 86389844ef2f40cc9d3f0469de2bd6dc
Fetching changes...
Initialized empty Git repository in /builds/kulusesouriant/website/.git/
Created fresh repository.
Checking out f839d639 as detached HEAD (ref is master)...
Updating/initializing submodules recursively...
Submodule 'themes/hugo-cloak-email' (https://github.com/martignoni/hugo-cloak-email.git) registered for path 'themes/hugo-cloak-email'
Submodule 'themes/hugo-coder' (https://github.com/luizdepra/hugo-coder.git) registered for path 'themes/hugo-coder'
Synchronizing submodule url for 'themes/hugo-cloak-email'
Synchronizing submodule url for 'themes/hugo-coder'
Cloning into '/builds/kulusesouriant/website/themes/hugo-cloak-email'...
Cloning into '/builds/kulusesouriant/website/themes/hugo-coder'...
Submodule path 'themes/hugo-cloak-email': checked out '19e0284810127d1d56e2d813a311b0bd73bba96c'
Submodule path 'themes/hugo-coder': checked out '6bc00595434affd85e9d55af98779460de6fb1cd'
Updated submodules
Synchronizing submodule url for 'themes/hugo-cloak-email'
Synchronizing submodule url for 'themes/hugo-coder'
Entering 'themes/hugo-cloak-email'
Entering 'themes/hugo-coder'
Entering 'themes/hugo-cloak-email'
Entering 'themes/hugo-coder'
$ git remote set-url origin "${CI_REPOSITORY_URL}" || echo 'Not a git repository; skipping'
Executing "step_script" stage of the job script 00:13
Using effective pull policy of [always] for container golang:1.25.1-bookworm
Using docker image sha256:80d0c273b68be554ca551c61b4a22ef66baae074f3a9562636139ba01972e5b1 for golang:1.25.1-bookworm with digest golang@sha256:c423747fbd96fd8f0b1102d947f51f9b266060217478e5f9bf86f145969562ee ...
$ echo "Creating directory for user-specific executable files..."
Creating directory for user-specific executable files...
$ mkdir -p "${HOME}/.local"
$ echo "Installing utilities..."
Installing utilities...
$ apt-get update
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8791 kB]
Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [6924 B]
Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [281 kB]
Fetched 9333 kB in 1s (8772 kB/s)
Reading package lists...
$ apt-get install -y brotli xz-utils zstd
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  brotli xz-utils zstd
0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded.
Need to get 1449 kB of archives.
After this operation, 4196 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main amd64 xz-utils amd64 5.4.1-1 [471 kB]
Get:2 http://deb.debian.org/debian bookworm/main amd64 brotli amd64 1.0.9-2+b6 [277 kB]
Get:3 http://deb.debian.org/debian bookworm/main amd64 zstd amd64 1.5.4+dfsg2-5 [701 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 1449 kB in 0s (10.4 MB/s)
Selecting previously unselected package xz-utils.
(Reading database ... 15617 files and directories currently installed.)
Preparing to unpack .../xz-utils_5.4.1-1_amd64.deb ...
Unpacking xz-utils (5.4.1-1) ...
Selecting previously unselected package brotli.
Preparing to unpack .../brotli_1.0.9-2+b6_amd64.deb ...
Unpacking brotli (1.0.9-2+b6) ...
Selecting previously unselected package zstd.
Preparing to unpack .../zstd_1.5.4+dfsg2-5_amd64.deb ...
Unpacking zstd (1.5.4+dfsg2-5) ...
Setting up xz-utils (5.4.1-1) ...
update-alternatives: using /usr/bin/xz to provide /usr/bin/lzma (lzma) in auto mode
Setting up zstd (1.5.4+dfsg2-5) ...
Setting up brotli (1.0.9-2+b6) ...
$ echo "Installing Dart Sass ${DART_SASS_VERSION}..."
Installing Dart Sass 1.93.2...
$ curl -sLJO "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
$ tar -C "${HOME}/.local" -xf "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
$ rm "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
$ export PATH="${HOME}/.local/dart-sass:${PATH}"
$ echo "Installing Hugo ${HUGO_VERSION}..."
Installing Hugo 0.145.0...
$ curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
$ mkdir "${HOME}/.local/hugo"
$ tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
$ rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
$ export PATH="${HOME}/.local/hugo:${PATH}"
$ echo "Installing Node.js ${NODE_VERSION}..."
Installing Node.js 22.18.0...
$ curl -sLJO "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz"
$ tar -C "${HOME}/.local" -xf "node-v${NODE_VERSION}-linux-x64.tar.xz"
$ rm "node-v${NODE_VERSION}-linux-x64.tar.xz"
$ export PATH="${HOME}/.local/node-v${NODE_VERSION}-linux-x64/bin:${PATH}"
$ echo "Verifying installations..."
Verifying installations...
$ echo Dart Sass: $(sass --version)
Dart Sass: 1.93.2
$ echo Go: $(go version)
Go: go version go1.25.1 linux/amd64
$ echo Hugo: $(hugo version)
Hugo: hugo v0.145.0-666444f0a52132f9fec9f71cf25b441cc6a4f355+extended linux/amd64 BuildDate=2025-02-26T15:41:25Z VendorInfo=gohugoio
$ echo Node.js: $(node --version)
Node.js: v22.18.0
$ echo brotli: $(brotli --version)
brotli: brotli 1.0.9
$ echo xz: $(xz --version)
xz: xz (XZ Utils) 5.4.1 liblzma 5.4.1
$ echo zstd: $(zstd --version)
zstd: archetypes assets config content go.mod go.sum i18n layouts resources static themes Zstandard CLI (64-bit) v1.5.4, by Yann Collet archetypes assets config content go.mod go.sum i18n layouts resources static themes
$ echo "Installing Node.js dependencies..."
Installing Node.js dependencies...
$ [[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci --prefer-offline || true
$ echo "Configuring Git..."
Configuring Git...
$ git config core.quotepath false
$ echo "Building site..."
Building site...
$ hugo --gc --minify --baseURL "${CI_PAGES_URL}"
hugo: collected modules in 1061 msStart building sites … 
hugo v0.145.0-666444f0a52132f9fec9f71cf25b441cc6a4f355+extended linux/amd64 BuildDate=2025-02-26T15:41:25Z VendorInfo=gohugoio
                   | FR | EN  
-------------------+----+-----
  Pages            | 69 | 67  
  Paginator pages  | 12 | 12  
  Non-page files   |  0 |  0  
  Static files     | 22 | 22  
  Processed images |  0 |  0  
  Aliases          |  4 |  3  
  Cleaned          |  6 |  6  
Total in 1682 ms
$ echo "Compressing published files..."
Compressing published files...
$ find public/ -type f -regextype posix-extended -regex '.+\.(css|html|js|json|mjs|svg|txt|xml)$' -print0 > files.txt
$ time xargs --null --max-procs=0 --max-args=1 brotli --quality=10 --force --keep < files.txt
$ time xargs --null --max-procs=0 --max-args=1 gzip -9 --force --keep < files.txt
real	0m0.732s
user	0m1.130s
sys	0m0.304s
real	0m0.161s
user	0m0.084s
sys	0m0.205s
Uploading artifacts for successful job 00:02
Uploading artifacts...
public: found 714 matching artifact files and directories 
Uploading artifacts as "archive" to coordinator... 201 Created  correlation_id=d27da22effb14d4a8bf803257e09ef73 id=11652405392 responseStatus=201 Created token=6b_B9c_zf
Cleaning up project directory and file based variables 00:00
Job succeeded

As for the different versions it’s my bad I might have copied a log from when I tried version 141 instead of 145. I want to use 145.0 because the changes in 146 broke my css theme and I don’t know yet how to fix it. I have a workaround in my local version (hugo 151) but it only works with hugo server and not when I compile the site. I know I’ll have to dig into this but I didn’t have time for this now and it’s more important to have the youtube videos working on my website now.

Concerning the RAW html omitted warning I don’t see it in the newer logs with hugo 145. It has to do with the cloakemail module but I can safely ignore it.

Locally (hugo version 151.0), except the broken theme which needs a workaround, the hugo modules works…

Do you think it really is because of the hugo or the go versions ?

I don’t see anything mentioning the hugo module in the pipeline logs, so it seems to me that the youtube module doesn’t even compile on the gitlab version.

I know its author, @davidsneighbour is around sometimes. If you see this and have the time maybe you could help me understand how to make it work in the situation :folded_hands:

See Requesting Help.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Again, thank you for your patience and pedagogy. It’s really appreciated

Here’s my code

Edit : I was able to fix the display problem (css not loading) in newer versions of hugo so I pushed it to gitlab with hugo version 151, same as in the local version.

The hugo module works locally but still not online with the same hugo and go versions.

mmh, this looks like the codebase on gitlab and your local site is not the same at least for the repo you shared.

try it out on your machine and spot the differences between your working site you look at (after you cleard public :wink:

git clone
PS> git clone --recurse https://gitlab.com/kulusesouriant/test.git topic-56064-gitlabYoutube
Cloning into 'topic-56064-gitlabYoutube'...
remote: Enumerating objects: 1184, done.
remote: Total 1184 (delta 0), reused 0 (delta 0), pack-reused 1184 (from 2)
Receiving objects: 100% (1184/1184), 2.19 MiB | 3.23 MiB/s, done.
Resolving deltas: 100% (611/611), done.
Submodule 'themes/hugo-cloak-email' (https://github.com/martignoni/hugo-cloak-email.git) registered for path 'themes/hugo-cloak-email'
Submodule 'themes/hugo-coder' (https://github.com/luizdepra/hugo-coder.git) registered for path 'themes/hugo-coder'
Cloning into 'C:/_repos/github/clone/topic-56064-gitlabYoutube/themes/hugo-cloak-email'...
remote: Enumerating objects: 110, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 110 (delta 3), reused 13 (delta 2), pack-reused 91 (from 1)
Receiving objects: 100% (110/110), 40.12 KiB | 2.00 MiB/s, done.
Resolving deltas: 100% (38/38), done.
Cloning into 'C:/_repos/github/clone/topic-56064-gitlabYoutube/themes/hugo-coder'...
remote: Enumerating objects: 4176, done.
remote: Counting objects: 100% (92/92), done.
remote: Compressing objects: 100% (51/51), done.
remote: Total 4176 (delta 66), reused 41 (delta 41), pack-reused 4084 (from 2)
Receiving objects: 100% (4176/4176), 6.09 MiB | 6.12 MiB/s, done.
Resolving deltas: 100% (2176/2176), done.
Submodule path 'themes/hugo-cloak-email': checked out '19e0284810127d1d56e2d813a311b0bd73bba96c'
Submodule path 'themes/hugo-coder': checked out '6bc00595434affd85e9d55af98779460de6fb1cd'
hugo server
PS> cd topic-56064-gitlabYoutube
PS> hugo server
Watching for changes in C:\_repos\github\clone\topic-56064-gitlabYoutube\{_vendor,archetypes,assets,content,i18n,layouts,static,themes}
Watching for config changes in C:\_repos\github\clone\topic-56064-gitlabYoutube\config\_default, C:\_repos\github\clone\topic-56064-gitlabYoutube\_vendor\github.com\davidsneighbour\hugo-modules\modules\youtube\config\_default, C:\_repos\github\clone\topic-56064-gitlabYoutube\themes\hugo-coder\hugo.toml, C:\_repos\github\clone\topic-56064-gitlabYoutube\go.mod
Start building sites …
hugo v0.151.0-c70ab27ceb841fc9404eab5d2c985ff7595034b7+extended windows/amd64 BuildDate=2025-10-02T13:30:36Z VendorInfo=gohugoio

INFO  build:  step process substep collect files 116 files_total 116 pages_total 116 resources_total 0 duration 5.3515ms
INFO  build:  step process duration 5.3515ms
INFO  build:  step assemble duration 3.39ms
INFO  static: syncing static files to \ duration 18.853ms
DEBUG Write redirect to main language fr: http://localhost:1313/fr/
INFO  build:  step render substep pages site fr outputFormat html duration 246.9331ms
INFO  build:  step render substep pages site fr outputFormat rss duration 9.3033ms
INFO  build:  step render substep pages site en outputFormat html duration 77.6151ms
INFO  build:  step render substep pages site en outputFormat rss duration 2.9577ms
INFO  build:  step render pages 160 content 122 duration 341.4325ms
INFO  build:  step render deferred count 0 duration 0s
INFO  build:  step postProcess duration 0s
INFO  build:  duration 350.174ms

                  │ FR │ EN
──────────────────┼────┼────
 Pages            │ 69 │ 67
 Paginator pages  │ 12 │ 12
 Non-page files   │  0 │  0
 Static files     │ 22 │ 22
 Processed images │  0 │  0
 Aliases          │  4 │  3
 Cleaned          │  0 │  0

Built in 352 ms
Environment: "development"
Serving pages from disk
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

browse to these and open your developer console (F12 in Chrome)

ERROR 404 → http://localhost:1313/libs/liteyoutube/lite-yt-embed.js

and indeed there’s no such javascript file in your published site.

I did not dig into the shortcode code of the module, but if you copy the missing lite-yt-embed.js file to your static/libs/liteyoutube folder - all is fine and the videos play :wink:

guess there’s some code to fetch the resource from assets somewhere and publish it without defensive coding either inside the original or your customization.

update: just seen you also _vendor the modules, so you won’t get any updates …

Mmmh weird…

The repo I shared is the same as my main. I just forked it because the main one needs to be private to work with gitlab pages.

To be sure I cloned the forked repo and launched hugo server(I used the exact same commands as you). And it works for me. The videos are working. The module is supposed to generate and mount the needed files, which it does for me locally.

I created a static/libs/liteyoutube folder and copied the missing file, then pushed it to gitlab. This solved the problem for the online website. The videos are loading now.

But I don’t understand why it is needed since I don’t need to for the local version. I don’t know why it’s not working for you either…

Also I won’t have updates on this file I guess…

Maybe something is missing in my .gitlab-ci.yml file to generate the module files ?

Btw you’re right, I removed the _vendor folder which is not necessary (it was here for testing purposes).

Anyway thank you so much for taking the time…

No. There is nothing missing.

It’s still in your repository, as is the resources directory which you should remove. You need to do:

git rm -rf _vendor/ resources/
git add -A
git commit -m "Remove _vendor and resources directories from source control"
git push

Yes I only did it on the main repo, not the fork. But it’s done on both now. They are identical.

Here it is

For future reference, I recommend you share the origin, not a fork, when requesting help.

I can’t because gitlab requires the main repo to be private in order to publish the website publicly. Thus I forked it to be able to share the code.

Here’s a public GitLab repo:
https://gitlab.com/jmooring/hosting-gitlab-pages

Here’s the served site:
https://jmooring.gitlab.io/hosting-gitlab-pages/

mmmh ok I was wrong apparently. I remember there was a reason when I first uploaded the site to gitlab. Anyway this is not the point…

Now I can’t change my main repo visibility to public. (which is honestly better for me anyway for privacy reasons).

Thank you anyway for showing me that it is possible.

Concerning my problem the two repos are the exact same so it won’t prevent people to help if they want to.

I plan to remove the forked on once the problem is solved because I don’t want to expose my number and email address too long web crawlers.

I cloned your repo again and it works.

now I did

  • delete the public folder
  • removed the static/lib directory
  • hugo server

and it does not work anymore => I suppose you did not clean your public folder a while. Hugo does not clean it for you.

check if you have a public/static/libs right now.

Do the following

  • remove or rename the static/lib directory
  • rename your public folder → pub_backup (make sure that you don’t have one
  • regenerate your site using hugo server

make sure to clean your browsercache…

→ educated guess it won’t show the videos.

Ok I did all this before except clean my browser cache. I did it now and, you’re right, it doesn’t work. It explains why it worked for you and not for me…

That means that the public folder in my gitlab repo contains a static/libs/liteyoutube/lite-yt-embed.js file from a while ago, right ? (since I didn’t have a static/libsfolder before…

Before I mark this as solved I have one more question. Since I manually copied this file to static/libs, when the module will get updated, this file won’t be updated so I’ll need to manually get it from the module’s github and copy it there right ?

It does solve the problem, which is great. But it feels like a workaround. The module is suppose to take care loading this file into the public folder no?

Anyway thank you again for helping with this issue, it is really precious to have people like you with a better understanding of the things when you are still learning… :folded_hands:

See module docs:
https://github.com/davidsneighbour/hugo-modules/blob/main/modules/youtube/documentation/index.md#resources

Specifically…

You need to add the following files to your pipelines

For example…

git clone --single-branch -b hugo-forum-topic-56064 https://github.com/jmooring/hugo-testing hugo-forum-topic-56064
cd hugo-forum-topic-56064
hugo server
1 Like

Thank you ! I forgot this part in the docs !!! I’ll try to make it work when I have a minute and report it it as solution.