Hugo

404 page not working except on home page

Hey all, we just moved our site, Julialang org to Hugo. When I do julialang.org/fakeurl I get the correct 404 page, but when I do julialang.org/jsoc/fakeur I am missing the css on the page.

Any suggestions to fix this?

I would guess it’s how your css paths are constructed. Browsing, for example this page gets 404s on the console for missing assets.

Yeah, so https://julialang.org/hi gives the correct 404 page but https://julialang.org/jsoc/hi gives the missing css 404 page.

It’s also weird to note that the Netlify website deploy preview works fine for the 404’s, but then we we actually deploy with GitHub Pages, the 404 works differently…

For reference, this is where our css paths are setup: https://github.com/JuliaLang/www.julialang.org/blob/09fa198b4f6b8449a3d0f74cf1a2733ce7b10047/layouts/partials/head.html#L14

When you look a the sourcecode here:

view-source:https://julialang.org/jsoc/fakeur

Your stylesheets links are incorrect:

<link rel="stylesheet" href="./v2/css/bootstrap.min.css" />
<link rel="stylesheet" href="./v2/css/app.css" />
<link rel="stylesheet" href="./v2/css/fonts.css" />

I’m not entirely sure why this is happening, but there are a couple things to try. First, you may want to try changing the baseURL in your config to include the protocol. Currently it is set to:

baseURL: julialang.org

Try changing this to:

baseURL: https://julialang.org

If that doesn’t fix it, then you could also just get rid of the absURL function for those links here:

1 Like

Switching to HTTPS for the base URL did the Job! Thanks!

1 Like