Deployment passes old *.netlify.com subdomain to Hugo in $URL

How to reproduce

  1. Have an old Hugo site on the default *.netlify.com subdomain
    By old I mean that it was first configured before the switch to the *.netlify.app subdomains.

  2. Access your site’s sitemap, e.g. https://example.netlify.app/sitemap.xml (https://example.netlify.com/sitemap.xml also works and just redirects to the former)

  3. In the sitemap XML all specified URIs still use the *.netlify.com subdomain.

Impact: For your *.netlify.app site you cannot register the sitemap in Google’s webmaster tools as it rejects the sitemap saying that it can only process URIs on the same subdomain (i.e. with *.netlify.app).

Workaround: Open netlify.toml in your Hugo project and edit

[build]
  command = "hugo --gc --minify -b $URL"
  publish = "public"

to

[build]
  command = "hugo --gc --minify -b https://example.netlify.app"
  publish = "public"

Hey @ComFreek! thanks for posting that. As announced, we are doing some migration work at present - we’ll check in on this behaviour soon!

Should be fixed as of 17:11 UTC yestrday @ComFreek - could you confirm that you URL is returning the right thing now?

2 Likes

Thank you, it is working as intended now!

1 Like