Getting a 404 for my website. I think DNS is the culprit

So I purchased my domain from namecheap.com, I (would like to) do my hosting through Cloudflare pages.

My domain is braakit.ca. I created a hugo static website and uploaded it successfully.
I also set my nameservers (from the namecheap dashboard) to marvin.ns.cloudflare.com and ollie.ns.cloudflare.com as the documentation for setting up a hugo site suggested.

The “edge certificates” seem to be enabled (from the Cloudflare dashboard).

Connecting to braakit.ca direct gives a 404
Connecting to www.braakit.ca gives a little page that seems to be a 404 but from namecheap’s servers?

I would appreciate any help, I’m not to experienced with this website stuff

Did you add the custom domains in your Pages project?

Yes, on the “Websites” page, it says my custom domain is active.

In the Pages project itself you need to add the names, so it knows to answer to them. This will also add DNS entries automatically. The link in my previous post should take you there.


This is what that link looks like for me right now. Is this not what I want already?

Okay, first, also add www.braakit.ca to the project as a custom domain so both versions will be there.

Then, both names will give you the same 404, which is a separate problem–something in the way you deployed the site isn’t right. Did you do it via direct upload or from Github?

If you used direct upload, make sure you didn’t upload a directory that has all your files in it. If for example you uploaded the ‘public’ directory that Hugo built for you, and you ended up with something like:

public
├── foo.html
└── index.html

…then your entire site is in the subfolder when it should be in the main directory.

Or, if you used Github to deploy your site, what build config did you use? And is your Github repo public?

Ok, I added that www.braakit.ca.

I uploaded via hugo from github (https://github.com/nednoodlehead/braakit-site)

When uploading from that repo, it gave a “successful upload” message.

And in my repo, I did not include the public folder as I thought that it wasn’t needed. The rest of the files builds that. And if it wasn’t that way, why did Cloudflare give me a successfuly upload message

You don’t need to include the public folder if you’re using Github and building at Cloudflare.

However, you didn’t tell Hugo what theme to use in the config.toml file. The theme is there, so just add this to config.toml:

theme = 'color-your-world'

Then the site will build.

1 Like

Ah you were right. I failed to push that to remote. Now it fails with a build error:

21:53:14.593 Error: /opt/buildhome/repo/themes/color-your-world/layouts/partials/basic-tags.html:83:1: parse failed: template: partials/basic-tags.html:83: function return not defined
21:53:14.600 Failed: build command exited with code: 255

Guess thats more of a theme issue than anything. builds fine for myself so… dunno

Oh, yeah. For Hugo if you don’t set the version, it uses a very old version.

Set a HUGO_VERSION environment variable to 0.105.0 on the project (or whatever version of Hugo you’re using). This link should get you to the right page in the dashboard.

2 Likes

Yup! That worked.

One more thing if you don’t mind, google seems to not have too much on this but my site seems unable to access the javascript & css required. Right now my site is a bare bones html site.

The closest thing I found was: https://community.cloudflare.com/t/site-deployed-with-hugo-css-not-loading/427600/3 Which suggested taking down the www dns record. Which I tried, and didn’t seem to work.

Thank you for your replies!

Oops, you’ve left baseURL set to example.org in your config, so it’s trying to load your stylesheets from there. Change that to the real URL.

2 Likes

Perfect. Can’t thank you enough. I’ll mark the answer to my original issue.

2 Likes

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