Skip to content

Conversation

@canerakdas
Copy link
Member

Description

With this PR, we aim to use the OG images / meta descriptions from the website with the new web generator as well

Validation

In the preview should contain og image content and display it correctly

Related Issues

#535

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have check code formatting with node --run format & node --run lint.
  • I've covered new added functionality with unit tests if necessary.

@canerakdas canerakdas requested a review from a team as a code owner December 26, 2025 13:41
Copilot AI review requested due to automatic review settings December 26, 2025 13:41
@vercel
Copy link

vercel bot commented Dec 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
api-docs-tooling Ready Ready Preview Dec 26, 2025 1:42pm

<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 👍

@codecov
Copy link

codecov bot commented Dec 26, 2025

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.11%. Comparing base (776dd0b) to head (be2885f).
⚠️ Report is 5 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/generators/web/utils/processing.mjs 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #538      +/-   ##
==========================================
+ Coverage   79.82%   80.11%   +0.28%     
==========================================
  Files         121      123       +2     
  Lines       12017    12144     +127     
  Branches      840      856      +16     
==========================================
+ Hits         9593     9729     +136     
+ Misses       2421     2412       -9     
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds Open Graph (OG) meta tags and a meta description to the web generator's HTML template to improve how API documentation pages appear when shared on social media and in search results. This addresses part of issue #535 which requested adding meta descriptions and reusing OG images from the main Node.js website.

Key Changes

  • Added meta description tag with Node.js standard description
  • Added OG meta tags (og:title, og:description, og:image) for social media sharing
  • Modified template processing to support dynamic OG image URL generation using the page title

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/generators/web/template.html Added meta description and Open Graph tags for social media preview support
src/generators/web/utils/processing.mjs Modified to create title variable and generate URL-encoded title for OG image placeholder replacement

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<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.
<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.

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.
@AugustinMauroy
Copy link
Member

Also what if we statically generate og image on this side ?

@avivkeller
Copy link
Member

Also what if we statically generate og image on this side ?

Why? We already have it on our website, why add complexity here?

@bjohansebas
Copy link
Member

Why? We already have it on our website, why add complexity here?

Maybe because if the URL changes (which I hope never happens), the OG image would no longer work. By generating it here, that problem wouldn’t exist.

@canerakdas
Copy link
Member Author

Why? We already have it on our website, why add complexity here?

Maybe because if the URL changes (which I hope never happens), the OG image would no longer work. By generating it here, that problem wouldn’t exist.

I think we also cannot use these images in a scenario where the website is statically exported, but I agree that there is a cost to creating them

@canerakdas canerakdas marked this pull request as draft December 26, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants