Skip to content

Bug: themeColor and viewport incorrectly placed inside metadata export in layout.js #310

@HamidKhan1001

Description

@HamidKhan1001

🐛 Describe the bug

Issue description:

In `app/layout.js` (lines 21-22), `themeColor` and `viewport` are 
defined inside the `metadata` export object.

Since Next.js 13.4+, these fields were moved to a dedicated `viewport` 
export. Keeping them inside `metadata` causes Next.js to log a warning 
and these values may not be applied correctly by the browser.

## Current code (incorrect)
export const metadata = {
  ...
  themeColor: "#000000",
  viewport: "width=device-width, initial-scale=1",
};

## Expected code (correct)
export const metadata = {
  ...
  // themeColor and viewport removed
};

export const viewport = {
  themeColor: "#000000",
  width: "device-width",
  initialScale: 1,
};

## Reference
https://nextjs.org/docs/app/api-reference/functions/generate-viewport

I'd like to work on this and have a fix ready.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions