Hugo, URLS and Local Host switching during deployment

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.