Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: SEO data added again #1431

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading