diff --git a/src/generators/web/template.html b/src/generators/web/template.html index 049f4ba2..ea6fd299 100644 --- a/src/generators/web/template.html +++ b/src/generators/web/template.html @@ -6,7 +6,11 @@ {{title}} + + + + diff --git a/src/generators/web/utils/processing.mjs b/src/generators/web/utils/processing.mjs index fb017dd7..998d7590 100644 --- a/src/generators/web/utils/processing.mjs +++ b/src/generators/web/utils/processing.mjs @@ -111,14 +111,16 @@ export async function processJSXEntries( // Step 3: Create final HTML (could be parallelized in workers) const results = entries.map(({ data: { api, heading } }) => { const fileName = `${api}.js`; + const title = `${heading.data.name} | ${titleSuffix}`; // Replace template placeholders with actual content const renderedHtml = template - .replace('{{title}}', `${heading.data.name} | ${titleSuffix}`) + .replace('{{title}}', title) .replace('{{dehydrated}}', serverBundle.pages.get(fileName) ?? '') .replace('{{importMap}}', clientBundle.importMap ?? '') .replace('{{entrypoint}}', `./${fileName}?${randomUUID()}`) - .replace('{{speculationRules}}', SPECULATION_RULES); + .replace('{{speculationRules}}', SPECULATION_RULES) + .replace('{{ogTitle}}', encodeURIComponent(title)); // Minify HTML (input must be a Buffer) const finalHTMLBuffer = HTMLMinifier.minify(Buffer.from(renderedHtml), {});