In angular 2 how to make a canonical tag on index.html page dynamically change

In angular 2, how to make a canonical tag in a dynamic index.html page so that I can publish the URLs of pages on social networks.

This is it at present:

<link rel="canonical" href="https://mywebsite.co.uk"> 
+6
source share
1 answer

This is not possible with angular 2 unless you are using universal angular. Are you using angular universal?

It may also be in the wrong direction. Typically, canonical tags are not designed to share a specific page, but are designed to prevent search engines from penetrating deeper into a specific area of ​​your site.

I think you want to dynamically configure meta tags for sharing on facebook and twitter. In this case, you can view this article to find out more information https://moz.com/blog/meta-data-templates-123

+1
source

All Articles