Bind baseURL

I want to use Hugo on multiple PCs in my network so I use the command

hugo server --renderToDisk --bind baserURL

as advised in this post

While it does work, all links revert back to localhost rendering this option useless. Am I doing something wrong?

baseURL in config.toml is set to “/”
hugo v0.82.0

The above does not look correct.

That does not look like a valid baseURL. You should set the baseURL in config.toml to your (most common) production URL.

seems to me this is the problem. try changing it to your production URL or maybe even to

And the flag is --baseURL not baserURL. Not sure if it’s a typo.

Otherwise, the command should work fine.

You are right in your observation, but the baseURL in config.toml is not used if it’s set as a flag.

right :sweat_smile:

what else could be the problem?

I suspect getting the flag syntax right should do it :slight_smile:

Thanks for your reactions and pointing out a typo, According to the docs, the right syntax should be

hugo server --renderToDisk baseURL

I am a bit confused whether or not to add --bind but either way the webserver is available at http://localhost:1313. Therefore {{ .Permalink }} in the HTML head still shows “http://localhost:1313/” making links on another PC useless.

Changing the baseURL in config.toml does not have any effect: {{ .Permalink }} shows “http://localhost:1313/

I use normally use flags as we use Netlify so it’s easy to configure development and production variables. Right now we are in development of this site so I just want to test features using our local network.

Where in the docs does it say the above? Because that is wrong and needs to be fixed.

Configure Hugo | Hugo states:

Hostname (and path) to the root, e.g.

Yes, but the baseURL flag needs to be prefixed with “–”.

Ouch, what a stupid mistake of me! It works beautifully now.
Apologies for wasting your time.

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