From be2885f98bb986f07b43ea66e1f1446c5141e57c Mon Sep 17 00:00:00 2001 From: Caner Akdas Date: Fri, 26 Dec 2025 16:31:19 +0300 Subject: [PATCH] feat: og image and meta description --- src/generators/web/template.html | 4 ++++ src/generators/web/utils/processing.mjs | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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), {});