Skip to content

Commit

Permalink
Fix: SEO data added again
Browse files Browse the repository at this point in the history
  • Loading branch information
Arpita-Jaiswal committed Oct 27, 2023
1 parent ec87a65 commit 919e359
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions fastn-js/js/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down Expand Up @@ -902,7 +902,7 @@ class Node2 {
}
}
updateMetaTitle(value) {
if (!ssr && hydrating) {
if (!ssr && (hydrating || rerender)) {
if (!fastn_utils.isNull(value)) window.document.title = value;
}
}
Expand All @@ -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);
Expand All @@ -923,15 +923,15 @@ 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);
document.head.appendChild(metaTag);
}
}
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];
Expand All @@ -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];
Expand Down Expand Up @@ -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';
Expand All @@ -1336,7 +1336,7 @@ class Node2 {
}
}
attachExternalJs(js) {
if (hydrating) {
if (hydrating || rerender) {
let js_tag = document.createElement('script');
js_tag.src = js;

Expand Down

0 comments on commit 919e359

Please sign in to comment.