I have a single-page app, i.e. page navigation and url changes happen with javascript, rather than full page loads.
Additionally, occasionally multiple variants of a url point to the same underlying page. So, I'd like to add canonical link elements to define which url is canonical.
Do I need to keep the canonical link element up-to-date at all times in the DOM as the url changes, or is it sufficient to set it once on page load and then leave it alone?