In angular 2 how do you make the canonical tag in the index.html page dynamically change
Asked Answered
F

1

6

In angular 2 how do you make the canonical tag in the index.html page dynamic so I can share page urls with social media.

This is it currently:

<link rel="canonical" href="https://mywebsite.co.uk">
Fabyola answered 8/3, 2016 at 13:3 Comment(1)
This is to help with sharing my blog pagesFabyola
S
1

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

Also this may not be the correct direction. Typically the canonical tags are not for sharing a particular page but are designed to stop search engines from crawling deeper into a particular area of your site.

I think you are looking to adjust the meta tags dynamically for sharing on facebook and twitter. Which in that case you can review this article to find out more information https://moz.com/blog/meta-data-templates-123

Scoop answered 15/6, 2017 at 17:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.