Hugo, URLS and Local Host switching during deployment

Hey everyone,

So I think for anyone who succeeded with deploying a website of some sort using Hugo knows that when you build your site, the hugo function somehow switches in the site URL with localhost during the build, or perhaps its the other way aound with the hugo server function. I was always curious about that and wondered if anyone understood how this is done. Thanks.

You have a baseURL setting in config.toml that is used for production (aka running just hugo). When running hugo server (dev mode …) the baseURL will be changed to what the server is running, aka http://localhost:1313.