Skip to content
Draft
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions src/generators/web/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="https://nodejs.org/static/images/favicons/favicon.png"/>
<title>{{title}}</title>
<meta name="description" content="Node.js® is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts.">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to suggestions for a better description

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What did we use on nodeJS.org ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is the same as the one we use on the nodejs.org

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's good 👍

<link rel="stylesheet" href="styles.css" />
<meta property="og:title" content="{{title}}">
<meta property="og:description" content="Node.js® is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts.">
<meta property="og:image" content="https://nodejs.org/en/next-data/og/announcement/{{ogTitle}}" />
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Open Graph meta tags are missing the og:url property, which is recommended by the Open Graph protocol. This property should contain the canonical URL of the page. Consider adding a meta tag like: <meta property="og:url" content="{{pageUrl}}"> and passing the appropriate URL through the template replacement.

Suggested change
<meta property="og:image" content="https://nodejs.org/en/next-data/og/announcement/{{ogTitle}}" />
<meta property="og:image" content="https://nodejs.org/en/next-data/og/announcement/{{ogTitle}}" />
<meta property="og:url" content="{{pageUrl}}">

Copilot uses AI. Check for mistakes.

Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding an og:type meta tag, which is a required property according to the Open Graph protocol. For documentation pages, the appropriate value would be "website" or "article". Add: <meta property="og:type" content="website">

Suggested change
<meta property="og:type" content="website">

Copilot uses AI. Check for mistakes.
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
Expand Down
6 changes: 4 additions & 2 deletions src/generators/web/utils/processing.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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), {});
Expand Down
Loading