code: function getCanonicalUrl() {
    let link;
    if (window.self !== window.top) {
      try {
        link = window.top.document.head.querySelector('link[rel="canonical"][href]');
      } catch (e) { }
    } else {
      link = document.head.querySelector('link[rel="canonical"][href]');
    }
  
    if (link) {
      return link.href;
    }
    return '';
  }
docs: /* Get current page canonical url