fix: remove <noscript> when static content is generated and rendered already

This commit is contained in:
Danny Koppenhagen
2023-06-19 14:11:57 +02:00
committed by Stefan Rotsch
parent 3dcb9075b7
commit 8876d3b1c7
4 changed files with 14 additions and 3 deletions

View File

@@ -67,6 +67,12 @@ const createStaticFiles = async () => {
rootEl.appendChild(headlineNode);
rootEl.appendChild(textNode);
// remove the <noscript> element as page has already been hydrated with static content
const noscriptEl = document.getElementsByTagName("noscript");
if (noscriptEl[0]) {
noscriptEl[0].remove();
}
} else {
console.warn(
'Element with ID "root" not found. Static site content will be empty.'