Skip to content

Hugo CSS styles broken on GitHub Pages with a custom domain (baseURL problem?) #2

@pdurbin

Description

@pdurbin

I followed https://gohugo.io/hosting-and-deployment/hosting-on-github/ and the site looked normal at https://iqss.github.io/hugo.dataverse.org/

Then I added hugo.dataverse.org as a custom domain and the CSS files are trying to come from weird URLs like https://hugo.dataverse.org/hugo.dataverse.org/assets/css/stylesheet.d6fcd20a4fb86efa4dfac8ec95da60244cc8871042183da1ef28e3a762ad79c8.css making the UI unstyled and crazy:

Screenshot 2024-12-06 at 5 04 27 PM

Over at https://discourse.gohugo.io/t/publication-on-github-pages-and-baseurl/43631 there are suggestions like this:

  • set baseURL = "/" but all your internal links need to be relative (not the best…)
  • add relativeURLs = true but maybe other things will break, you have to check internal links

Here's my current config:

% cat hugo.toml 
baseURL = 'https://hugo.dataverse.org/'
languageCode = 'en-us'
title = 'The Dataverse Project'
theme = 'PaperMod'
[params]
showBreadCrumbs = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions