Hey there. Love Hugo but seem to have hit a bit a of a snag.
My issue is that when building for development (
hugo -e development), even when deploying that development, it renders fine. Here’s an example site:
Yet when I build for production (
hugo -e production) the rendering is broken:
The cause of the problem seems to be that paths are not being produced correctly in production. For example:
If I manually remove the
.s it all renders fine as expected. Below are my configs. I shortened them just to what I thought might be relevant but my full repository is linked below.
config/_default/hugo.yaml looks like:
- path: github.com/google/docsy
- path: github.com/google/docsy/dependencies
The full project repository is on github under zeezephyr/urbanism-guide. I can’t add a third link as a new account.
main is the source branch that builds the
production branch. The
production branch is exactly as hugo outputs it except I made a small commit to disallow robots as I don’t want the site to be indexed just yet.
Lastly I also swear I’ve tried every combination of
relativeURLs plus every solution I could find on google plus trying some newer versions of hugo. Not sure what to do to resolve this. Thanks for any help in advance!
Although I don’t know if this is the root of your problem, that is not a valid baseURL.
The absolute URL (protocol, host, path, and trailing slash) of your published site (e.g.,
And there’s almost never a good reason to enable this.
Will give this and your other suggestion a try tomorrow. Though if this works it would be confusing as it should only affect the development builds.
The production build where I’m having the issue does have the fully qualified path.
Hard to say exactly what’s going on without access to your project, but disabling
relativeURLs is the first place to start.
Thanks! Will do.
My project his here btw:
GitHub - zeezephyr/urbanism-guide: A practical guide to urbanism in Austin and eventually the US.
main branch is the source
production branch is the built static site
relativeURLs and set all
baseURLs to fully qualified paths of where the sites are live and still have the same ultimate issue with rendering for the production build only (staging renders fine). The difference now is that file references aren’t prefixed with “.” but fixing that has oddly had no effect on the site rendering.
I cloned your site and installed dependencies:
git clone --recurse-submodules https://github.com/zeezephyr/urbanism-guide
When I run this:
hugo server -e production
I get this:
Then I installed a local server to use instead of hugo server, built the site for production, and served the site:
npm install serve
hugo -e production
npx serve public
And this is what I get:
Based on the above, it looks to me like Hugo is doing the right thing.
I haven’t dug into your GitHub Pages workflows, but I noticed that they are significantly different that what we recommend:
The workflow file in the documentation is based on the “Hugo starter action” published by the GitHub Pages team, and I have never had a problem with it.
As an experiment, you might try changing both of your GitHub Pages workflows to match the documentation.
Appreciate the help.
Finally figured it out. The issue was purgecss. I must have it misconfigured, disabled it and it worked.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.