Headers issue with Hugo site deployed to Pages

Hello everyone. I’m attempting to deploy my first Pages site. I’m a newbie to all of this. I’m using the Doks theme with the Hugo framework. The site looks and functions great locally. However, when I deploy on Pages, the headers are apparently all screwed up. The Doks theme was developed to be deployed on Netlify. I just read Cloudflare’s article " Migrating from Netlify to Pages." I believe I need to update the _headers file. I’ve attempted to move the headers from the netlify.toml to the _headers file, but I can’t seem to get it to work. Like I said, I’m a newbie to this. Could anyone please help me understand how to convert this netlify Hugo theme so I can deploy it on Pages? Please and thank you.


Post an example from your _headers file that isn’t working.

Thanks for the reply @KianNH. I’m actually not sure what the problem is. Idk if it’s the _headers. Just a theory.

The main problem is my site looks great locally but deploys as a mess of HTML without any CSS. I’ve tried using both the npm run build and hugo build command. I’m trying everything I can think of. I’m still getting the same issues. I set my baseURL to “/” once and then tried the actual pages.dev URL. Neither were successful. I’m running out of things to try. For my first Hugo site, this has become quite the time suck. Hopefully, someone can let me know what I’m doing wrong. Thanks again for the help.

My current repo:

This is how the site looks when deployed:

I found my mistake. The Cloudflare Stream video I placed on the front page apparently broke it. It’s odd it worked locally, but I’m sure the reason is over my head. The site is up and working now. Thanks.

1 Like