Netlify continuous deploy not recognizing the Hugo theme on my site (no build errors given)

Hi all,

I have a github repo that I use to continuously deploy my site to Netlify. The current site with my current theme builds and deploys just fine. However, I have a git branch where I'm trying to get a new theme implemented that I intend to switch to.

This new branch renders the theme just fine locally. When I push to github and the Netlify build is triggered, the site builds with no errors. However, the output is plain HTML with no discernible styling. See here: https://vigorous-curie-5890bb.netlify.com/

The repo/branch I'm building this site from is here: https://github.com/arkanian86/braden_live/tree/change-theme

When I drag and drop /public/ into Netlify, it builds with no errors but correctly displays styling.

Where am I going wrong? I have tried numerous settings in the netlify.toml and config.toml. I am using Hugo version 0.60.1. Any pointers would be helpful, thank you!

The links to the css aren't incorrect. Looks like they're missing a '/'.
https://vigorous-curie-5890bb.netlify.comcss/main.css should be
https://vigorous-curie-5890bb.netlify.com/css/main.css

<link rel=stylesheet type=text/css media=screen href=https://vigorous-curie-5890bb.netlify.comcss/main.css>
<link rel=stylesheet type=text/css href=https://vigorous-curie-5890bb.netlify.comcss/dark.css media="(prefers-color-scheme: dark)">
1 Like

Thank you for the quick reply! How do I find that code you're referencing?

In my config.toml I have a trailing '/' for the baseURL yaml line, which I thought would take care of this issue:

baseURL = "https://vigorous-curie-5890bb.netlify.com/"

All that aside, any suggestions on how to fix it?

Specifically, looks like these lines are where the culprit shows up. Appears that the processing strips trailing / from the base url.

At a quick glance, that Alison Hill article looks like it's got your answer.

Specifically the bit about using the relURL function

Bottom line? If your theme uses relURL or absURL to link to site resources like CSS, JavaScript, or static images, then whether or not you include a trailing slash in your baseurl should not matter at all.

And here is some tough love about your theme: if the most recent version does still require the trailing slash in the baseurl to “work” out of the box, I would seriously consider switching themes. This is a pretty good “canary in the coal mine” test regarding how up-to-date the theme author is, and how well the theme you have chosen adheres to Hugo templating best practices. If you are having pain with this now, it is likely not the only thing that will be painful about working with your theme.

1 Like

I just added the trailing slashes into that html blob you linked - site deploys perfectly now! Thank you for your help.

My next step will be to determine if my fix is just a quick fix or if I need to replace these baseURL references with relURL references - but for now I'm good. Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.