I am trying to add a canonical tag into our site EPiServer CMS 9 with Azure Cloud for all pages as below -
How ever when I add the tag on my page and view the source it only shows the relative path. So if the above tag is added on the page having url - www.mysite.com/page1 - it will appear as
In same way for Start page for example it appears as instead of
When I tried to run the application on localhost and debug it, it showed the full path on page source, but on deploying it in environment, it shows relative path.
David was also facing same issues in his post - "Canonical Tags - Full Path Required"
Could anyone has solution for this?
help is much appreciated.
Who is David, and which post?
This behavior is by design. The domain is omitted when it's matching the current request's. Please read the first comment on this post http://dodavinkeln.se/post/how-to-get-the-external-url-to-content.
There's nothing wrong with this though, your canonical element is working as intended. But I do agree with you that the domain shuld be returned as well.
If you change the site's url in admin to localhost, the domain will get omitted locally as well.