Confusion regarding baseURL

I have confusion regarding how baseURL works as well. But in my case I don’t have a URL to give it because I’m publishing on an internal Rancher site running Kubernetes. So I don’t really know what the URL will be at this point except for whichever IP address it gets assigned. So I’m at a loss for what I should be putting as my baseURL in my config.toml file. I’m assuming it would be some Rancher ENV variable but I can’t find them.

Has anyone else run into this issue?


When you build the site prior to publishing, you can specify the baseURL at the command line level, so that it does not matter what you set, really. If you can grab some info from the Rancher / Kubernetes site via script, you can just pass that to the hugo build script.

Assuming macOS or *nix, a concept:

localsiteurl=`some command to get url`
hugo --config="/path/to/project/config.toml" --baseURL="$localsiteurl" -s /path/to/project/ -d /tmp/
/path/to/rsync -avz --delete... etc
# or, just copy the folder...

I’ve needed to publish the same site to different domains before, and just put something like the above script commands in twice, against the same project folder.

1 Like