Canonical url
Closed this issue · 1 comments
Quicksaver commented
Need to set the canonical and og:url meta tags to the correct domain. We're using the following on besugo to fetch the correct value (i.e. custom domain) in Netlify.
Docs: https://docs.netlify.com/configure-builds/environment-variables/
// Get the correct netlify url to use as basedir; hugo needs a correct
// basedir for building absolute urls.
if (process.env.CONTEXT !== undefined) {
switch (process.env.CONTEXT) {
case 'production':
if (process.env.URL) {
baseurl = process.env.URL;
break;
}
// eslint-disable-next-line no-fallthrough
case 'deploy-preview':
case 'branch-deploy':
if (process.env.DEPLOY_PRIME_URL) {
baseurl = process.env.DEPLOY_PRIME_URL;
break;
}
// eslint-disable-next-line no-fallthrough
default:
if (process.env.DEPLOY_URL) {
baseurl = process.env.DEPLOY_URL;
break;
}
}
}
baseurl += '/';
pvhee commented