This commit is contained in:
Benjamin Toby 2026-03-17 14:58:08 +01:00
parent cefcad9b76
commit ecc841f7ed

View File

@ -10,6 +10,8 @@ export default async function genWebHTML({
component, component,
pageProps, pageProps,
bundledMap, bundledMap,
head,
module,
}: LivePageDistGenParams) { }: LivePageDistGenParams) {
const { ClientRootElementIDName, ClientWindowPagePropsName } = const { ClientRootElementIDName, ClientWindowPagePropsName } =
await grabContants(); await grabContants();
@ -19,6 +21,7 @@ export default async function genWebHTML({
); );
const componentHTML = renderToString(component); const componentHTML = renderToString(component);
const headHTML = head ? renderToString(head) : "";
// const SCRIPT_SRC = path.join("/public/pages", bundledMap.path); // const SCRIPT_SRC = path.join("/public/pages", bundledMap.path);
// const CSS_SRC = bundledMap.css_path // const CSS_SRC = bundledMap.css_path
@ -30,6 +33,7 @@ export default async function genWebHTML({
html += `<html>\n`; html += `<html>\n`;
html += ` <head>\n`; html += ` <head>\n`;
html += ` <meta charset="utf-8" />\n`; html += ` <meta charset="utf-8" />\n`;
html += ` <meta name="viewport" content="width=device-width, initial-scale=1.0">\n`;
if (bundledMap.css_path) { if (bundledMap.css_path) {
html += ` <link rel="stylesheet" href="/${bundledMap.css_path}" />\n`; html += ` <link rel="stylesheet" href="/${bundledMap.css_path}" />\n`;
} }
@ -42,6 +46,10 @@ export default async function genWebHTML({
html += `<script defer>\n${await grabWebPageHydrationScript({ bundledMap })}\n</script>\n`; html += `<script defer>\n${await grabWebPageHydrationScript({ bundledMap })}\n</script>\n`;
} }
if (headHTML) {
html += ` ${headHTML}\n`;
}
html += ` </head>\n`; html += ` </head>\n`;
html += ` <body>\n`; html += ` <body>\n`;
html += ` <div id="${ClientRootElementIDName}">${componentHTML}</div>\n`; html += ` <div id="${ClientRootElementIDName}">${componentHTML}</div>\n`;