I try to deploy a simple blog using Hugo and GitLab Pages.
I’ve done everything according to the “Hosting on Gitlab” tutorial and tried the Gitlab approach (i.e. fork an existing project and tweak it).
Everytime I encounter this unwanted behaviour:
when I leave baseUrl empty ("") I’ve got CSS working on the main page, but the links to the posts are broken or CSS doesn’t work on other pages
when I specify baseUrl according to the gitlab pages address: https://username.gitlab.io/project-name all links on the site work fine but CSS is missing for the whole site.
I don’t have this problem when I test the site locally using hugo server command.
Not sure if this will make a difference, but I see the CSS links are build with .Site.BaseURL vs absURL.
Try overriding the theme’s head.html. So copy themes/minos/layouts/partials/head.html and paste it at layouts/partials/head.html, then make these changes on lines 12-15:
@zwbetz Yes, slash solution worked, but thank you anyway – I will keep your solution in mind since I am learning Hugo and for sure will encounter other problems in the future. Thanks!