404 error on content folder when deployed to netlify

I am getting 404 error on my content folder when deployed to netlify, but not when run locally.

Here is my repo:

Here is my site deployed to netlify:

The “nights” menu item goes to nights content when running locally, but I get a 404 error when using the menu when deployed on netlify.

I have tried modifying my baseURL, adding and subtracting content from my netlify.toml file, renaming the content and the content folders, and I slept on it. I have no idea at this time why it works locally and not on netlify. Another other guess is that my pluralized list titles might be causing a problem, but I would think that unlikely, or that there is a setting in netlify that needs to be set for my content.

Any insight or help is appreciated.

What is the purpose of these wildcards in your .gitignore file?


Emacs backup files. I could have Emacs store them all in one place, but I kind of like them littered about.

How about trying to remove them? And then see if your issue is resolved.

Also it’s good practice to include the public folder in your .gitignore

I’ll try that, but I would hope the netlify isn’t reading my .gitignore file to deploy my site. That would be weird, don’t you think?

My site doesn’t have a public folder. Is that normal?

OK, that has been done, still 404.

It’s very weird for Hugo not being able to find the /content/ folder. Your config seems ok.

The only weird thing I noticed was the content of your .gitignore file. Beyond that maybe someone else can take a look.

Also regarding the /public/ folder if you type hugo the public folder will be generated in your repo along with the html of your site. It’s just an option so that your repo doesn’t get bloated.

I downloaded and tested your site locally.

When I run hugo server I was greeted with an empty page.

I took a better look at your config.

Remove the following line from your main menu configuration

url = "/nights"

And the site will be generated.

If you want the “nights menu” to appear only under your /nights/ section you do this in the template not in your config.

Cool music BTW.

Cloning my own repo into a new directory and running the site was something i didn’t try. That is a good test. When I do that it runs fine. Everything works as expected despite there being a bunch of missing folders. What version of hugo are you using? It might be a version issue which is why we are getting different results. I am running v0.37.1 linux/amd64 .

As for removing the “/nights” from my config, this breaks my menu. It seems like I used these correctly based on this documentation -> https://gohugo.io/content-management/menus/#add-non-content-entries-to-a-menu <- I do notice that they have a trailing “/”, I can try that next.

I tested on a Mac with Hugo 0.37

OK, I’ll find someone with a mac and see if I can get the same results. Might not be for a bit. Thank you for your help and the kind words on the tunes!

1 Like

My friend has a Mac. He cloned the repo and ran the site no problem without editing the config. The problem is the the deploy for sure.

My next guess is that there is a problem with netlify.toml file.

Ha! I got it. I had been running server as server -D this whole time, where netlify was not. I removed the draft variable from my header in nights and it fixed the problem.