Skip to content

Conversation

bmuenzenmeyer
Copy link
Collaborator

@bmuenzenmeyer bmuenzenmeyer commented Oct 13, 2025

Description

The base generateMetadata function is not taking /blog into account.
I don't quite understand this next convention and the params type and how it relates to our code - /blog is not coming in on the initial entrypoint.

This is also affecting the download archive logic. Perhaps we can code-golf a solution that doesn't require duplication.
Live at https://nodejs.org/en/download/archive/v24.10.0

Validation

View title at https://nodejs-org-git-8223-blog-title-openjs.vercel.app/en/blog/release/v24.10.0

image

Related Issues

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

@bmuenzenmeyer bmuenzenmeyer requested a review from a team as a code owner October 13, 2025 03:41
@Copilot Copilot AI review requested due to automatic review settings October 13, 2025 03:41
Copy link

vercel bot commented Oct 13, 2025

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

Project Deployment Preview Updated (UTC)
nodejs-org Ready Ready Preview Oct 13, 2025 3:41am

Copy link
Contributor

@Copilot 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 fixes an issue where blog pages were using the incorrect metadata generation route. The change ensures that blog-specific metadata is properly generated by creating a dedicated generateBlogMetadata function that includes the blog prefix in the route path.

  • Creates a new generateBlogMetadata function that properly constructs blog metadata routes
  • Updates blog pages to use the new blog-specific metadata generation function

Reviewed Changes

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

File Description
apps/site/next.dynamic.page.mjs Adds new generateBlogMetadata function with proper blog route handling
apps/site/app/[locale]/blog/[...path]/page.tsx Updates blog pages to use the new blog-specific metadata function

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

codecov bot commented Oct 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.39%. Comparing base (0aa1281) to head (4fa25c3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8224      +/-   ##
==========================================
- Coverage   76.43%   76.39%   -0.05%     
==========================================
  Files         115      115              
  Lines        9643     9643              
  Branches      316      317       +1     
==========================================
- Hits         7371     7367       -4     
- Misses       2271     2275       +4     
  Partials        1        1              

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

@bmuenzenmeyer bmuenzenmeyer linked an issue Oct 13, 2025 that may be closed by this pull request
* @param {{ params: Promise<{ path: Array<string>; locale: string }> }} props
* @returns {Promise<import('next').Metadata>} the metadata for the page
*/
export const generateBlogMetadata = async props => {
Copy link
Member

Choose a reason for hiding this comment

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

Instead of this, can we make an overload of generateMetadata that supports path prefixes?

Copy link
Member

Choose a reason for hiding this comment

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

/**
 * This generates each page's HTML Metadata
 *
 * @see https://nextjs.org/docs/app/api-reference/functions/generate-metadata
 *
 * @param {{ params: Promise<{ path: Array<string>; locale: string; prefix?: string }> }} props
 * @returns {Promise<import('next').Metadata>} the metadata for the page
 */
export const generateMetadata = async props => {
  const { path = [], prefix = '', locale = defaultLocale.code } = await props.params;

  const pathname = dynamicRouter.getPathname(path);

  return dynamicRouter.getPageMetadata(locale, `${prefix}${pathname}`);
};

Copy link
Member

@ovflowd ovflowd Oct 14, 2025

Choose a reason for hiding this comment

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

Then usage:

// This generates each page's HTML Metadata
// @see https://nextjs.org/docs/app/api-reference/functions/generate-metadata
export const generateMetadata = props => basePage.generateMetadata({ ...props, prefix: 'blog' });

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.

Blog title is missing in <title>

5 participants