From eb220500bab8a501770c792c25875061186882ed Mon Sep 17 00:00:00 2001 From: Arpita-Jaiswal Date: Fri, 27 Oct 2023 16:30:06 +0530 Subject: [PATCH] Fix: SEO data added again --- fastn-js/js/dom.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fastn-js/js/dom.js b/fastn-js/js/dom.js index 91f6d15c81..d462e2365c 100644 --- a/fastn-js/js/dom.js +++ b/fastn-js/js/dom.js @@ -806,7 +806,7 @@ class Node2 { return this.#parent; } removeAllFaviconLinks() { - if (hydrating) { + if (hydrating || rerender) { const links = document.head.querySelectorAll('link[rel="shortcut icon"]'); links.forEach( link => { link.parentNode.removeChild(link); @@ -815,7 +815,7 @@ class Node2 { } setFavicon(url) { - if (hydrating) { + if (hydrating || rerender) { if (url instanceof fastn.recordInstanceClass) url = url.get('src'); while (true) { if (url instanceof fastn.mutableClass) url = url.get(); @@ -902,7 +902,7 @@ class Node2 { } } updateMetaTitle(value) { - if (!ssr && hydrating) { + if (!ssr && (hydrating || rerender)) { if (!fastn_utils.isNull(value)) window.document.title = value; } } @@ -911,7 +911,7 @@ class Node2 { this.removeMetaTagByName(name); return; } - if (!ssr && hydrating) { + if (!ssr && (hydrating || rerender)) { const metaTag = window.document.createElement('meta'); metaTag.setAttribute('name', name); metaTag.setAttribute('content', value); @@ -923,7 +923,7 @@ class Node2 { this.removeMetaTagByProperty(property); return; } - if (!ssr && hydrating) { + if (!ssr && (hydrating || rerender)) { const metaTag = window.document.createElement('meta'); metaTag.setAttribute('property', property); metaTag.setAttribute('content', value); @@ -931,7 +931,7 @@ class Node2 { } } removeMetaTagByName(name) { - if (!ssr && hydrating) { + if (!ssr && (hydrating || rerender)) { const metaTags = document.getElementsByTagName('meta'); for (let i = 0; i < metaTags.length; i++) { const metaTag = metaTags[i]; @@ -943,7 +943,7 @@ class Node2 { } } removeMetaTagByProperty(property) { - if (!ssr && hydrating) { + if (!ssr && (hydrating || rerender)) { const metaTags = document.getElementsByTagName('meta'); for (let i = 0; i < metaTags.length; i++) { const metaTag = metaTags[i]; @@ -1322,7 +1322,7 @@ class Node2 { } } attachExternalCss(css) { - if (hydrating) { + if (hydrating || rerender) { let css_tag = document.createElement('link'); css_tag.rel = 'stylesheet'; css_tag.type = 'text/css'; @@ -1336,7 +1336,7 @@ class Node2 { } } attachExternalJs(js) { - if (hydrating) { + if (hydrating || rerender) { let js_tag = document.createElement('script'); js_tag.src = js;