Hugo deployment generates URLs to examplesite.com

Hi Mike!

At the first glance, this setting in your config looks wrong:

baseURL = “https://5ea2095cc71c3d92337e2ce9--hopeful-colden-3e1ffc.netlify.app”

This will likely have the effect that all the permalinks in your site will point to this specific deploy.

About this URL

This url points to one of the many atomic deploys your site has. This url is useful to show people a specific state your site was in at one point in time. But it will never update. New deploys will get a url with a new id.

Why is this a wrong Hugo setting?

Hugo uses the baseURL setting to base all the permalinks on it. Those are generated whenever a layout calls .Permalink on something.
Most likely you don’t want all the links and asset urls in your site to point to a specific deploy, right?

How can you fix it?

Hugo accepts the following value:

baseURL = "/"

This means it should not put a domain into permalinks, but make sure to make all urls absolute. The browser will then use whatever domain you’re accessing the site with.

By the way, we just had a very similar case in another topic: Redirects in page not updating URL correctly when deploying from github - #5 by marcus

1 Like