So whats the best way to handle Canonical Tags with Netlify/Algolia Plugin

I’m still struggling with this. Google Search Console, Semrush and all other SEO ‘helpers’ are all calling for me to include a Canonical tag in my Gatsby site.

If I hardcode to my website* - Algolia doesn’t crawl my site
If I use a relative Canonical /* - All the SEO helpers cry murder

So what’s the best plan of action here for me to fix this issue in Algolia opinion?
Is there some kind of environment variable from Netlify I can use to help like {DEPLOY_PRIME_URL}/* (Build environment variables | Netlify Docs)?

Any help much appreciated.


Indeed SEO recommendation have derived from recommendation to “obligation” while the spec of canonical URL does not differ from any other links, it should be acceptable as relative URL.

Fortunately we have implemented the solution:

The plugin can automatically alias your custom domain:

  • we automatically alias custom domains that are configured in Netlify ( Settings > Domain management > Custom domains ).
  • if not possible to configure that in Netlify, an option customDomain is available in your netlify.toml

Hope this helps,