vector-of-bool.github.io icon indicating copy to clipboard operation
vector-of-bool.github.io copied to clipboard

Canonical URL is not updated after loading page dynamically and changing URL via history.pushState()

Open Marat-Tanalin opened this issue 4 years ago • 0 comments

What I’m talking about is the element in the HEAD element of HTML document:

<link rel="canonical" href="/2019/10/07/modules-3.html">

Canonical URL is not only available to search engines, it’s also available to human users e.g. via the UsableHomeButton extension for Firefox. So it makes sense to update canonical URL together with visible URL when using Ajax and HTML5 History API.

Currently, after going from one page (e.g. C++ modules part 3) to another one (e.g. C++ modules part 1), the canonical URL still points to the canonical URL of the previous page loaded statically (part 3) instead of the current page loaded dynamically (part 1).

Marat-Tanalin avatar Oct 07 '19 17:10 Marat-Tanalin