# Canonical Meta Data Does Not Change Correctly in Discourse App when not loaded by a webcrawler

**URL:** <https://meta.discourse.org/t/canonical-meta-data-does-not-change-correctly-in-discourse-app-when-not-loaded-by-a-webcrawler/159435>\
**Category:** Feature\
**Created:** [31 juli 2020 om 17:00 UTC](https://meta.discourse.org/t/canonical-meta-data-does-not-change-correctly-in-discourse-app-when-not-loaded-by-a-webcrawler/159435 "2020-07-31T17:00:39Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)\
**Post date:** [31 juli 2020 om 17:00 UTC](https://meta.discourse.org/t/canonical-meta-data-does-not-change-correctly-in-discourse-app-when-not-loaded-by-a-webcrawler/159435/1 "2020-07-31T17:00:39Z")

</div>

There is a bug in the Discourse app related to updating the `<link rel="canonical">` meta data element in the `<head>` section of the Discourse DOM.

Basically, when a browser client enters the application, and the application is first loaded, the `<link rel="canonical" href="">` element will set according to that initial page load; but then when a user clicks in the app (normal user behavior), without reloading the page manually, the `<link rel="canonical">` link will not update.

I have tested this bug and reproduced it on the meta site:

> Fig 1. Enter meta from the home page, the canonical link is correct, as it the title element.

 ![Screen Shot 2020-07-31 at 11.43.24 PM](https://global.discourse-cdn.com/meta/original/3X/2/5/25ff0a0b907759b3df47e9afd495a860fe41ec85.jpeg)

> Fig 2. Visit a topic. The title element changes correctly, but the canonical link is not correct (does not update as it should).

 ![Screen Shot 2020-07-31 at 11.43.42 PM](https://global.discourse-cdn.com/meta/original/3X/4/6/46df86f40bbc0dd06ee511681ff1025ac55b4787.jpeg)

> Fig 3. Visit another topic. The title element changes correctly, but the canonical link is not correct (does not update as it should).

 ![Screen Shot 2020-07-31 at 11.43.56 PM](https://global.discourse-cdn.com/meta/original/3X/7/7/772571a2028626b51329a955bcff4aa939813f42.jpeg)

> Implications for SEO

This bug could adversely effect SEO because when Google indexes the page, if Googlebot is not “hard reloading” every page, the canonical information will be incorrect for each page (as in the image sequences above).

> Reproducibility

I have reproduced this bug consistently on both the meta site and our site.

> Notes

I have seen these kind of `node.js` (SPA) lifecycle issues before with other web frameworks (not only Ember) where DOM elements are not updated, based on (Ember and other SPA framework) lifecycle hooks within the web application framework.

---

_[View the full topic](https://meta.discourse.org/t/canonical-meta-data-does-not-change-correctly-in-discourse-app-when-not-loaded-by-a-webcrawler/159435)._
