Incorect url domain prefix in build preview links

In build preview, sometimes links redirect to the master website (using the main domain instead of the test domain)

For example for this Pull-request: https://github.com/letsencrypt/website/pull/641 with preview https://deploy-preview-641–letsencrypt.netlify.com/docs/ :

  • Links on the top menu start with https://deploy-preview-641–letsencrypt.netlify.com/
  • Links in the page incorrectly start with https://letsencrypt.org

This makes the navigation in the preview difficult.

Is there something missing/wrong in the Hugo source or is it a netlify bug? (when building locally the website, all links have localhost as base)

@tdelmas, thank you for this question and welcome to our community site! :+1:

My best guess is the site markdown is using absURL and not relURL for the links.

Using absURL includes an absolute link with a domain name whereas relURL will make relative links which will be independent of the domain.

Changing the absURL links to relURL should resolve this.

If this solution doesn’t work for any reason or there are other questions about this, we are happy to answer.

1 Like

Thank you for that answer!

You’re probably right, I’ll check the code. (I hope it will be easy to fix, the code is a little complex, using full urls to handle partial translation and rewrite links)

I’ll post an update once I have more details.

1 Like

great! let us know what you find!