Sitemap and baseurl

Hello. I have empty baseurl in config, because I want to use this site on 2 domains.
But in sitemap.xml baseurl empty too and I have links like
Google requires that the link be full +
How to do it?

I would stop thinking to hard and set the baseURL and build the site twice.

I agree. But I would like automation. To do this, I would like to have a variable that would always put the domain in the sitemap.
I just check the site on the test domain first, and then I publish it on the main domain. The empty baseurl parameter gives me a plus in that I’m not attached to a domain. But I always want to generate a map of the site with a given domain.

I’m pushing to three servers simultaneously using three generate lines in a zsh “deploy” function.

See this gist for the basic idea, and click through to my actual .zshrc.

Having it specified in the hugo command arg will override the baseURL in the config, so you just do it however many times you need, then push to your site folders.


I understand, but I have the following sequence:

  1. Generating the demo site
  2. Checking the site’s performance
  3. Copy the site to the main site

That’s why I do not want to be attached to (ie baseurl should be empty), but sitemap.xml must contain

When you build your site, pass the baseURL in as a flag. Or check for an env variable. Your steps are too abstracted for me to provide you with any real concrete examples.

Can’t you check perf locally?

@igramnet what you are asking does not make sense. Adapt your sequence: The duplication of the site will not have any effect on your performance and it will make a much simpler mental model, even a possible one …