Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Title does not change while changing routes - Next js 13 appDir #42784

Closed
1 task done
mjad218 opened this issue Nov 11, 2022 · 3 comments
Closed
1 task done

Title does not change while changing routes - Next js 13 appDir #42784

mjad218 opened this issue Nov 11, 2022 · 3 comments
Labels
area: app App directory (appDir: true) bug Issue was opened via the bug report template. Metadata Related to Next.js' Metadata API.

Comments

@mjad218
Copy link

mjad218 commented Nov 11, 2022

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information


Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Home
    Binaries:
      Node: 18.12.1
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 13.0.3
      eslint-config-next: 13.0.3
      react: 18.2.0
      react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

Title does not change while navigating between routes.

Also, Next js 13 moves meta tags inside the body to the head.

Expected Behavior

Title should change when the route changes.

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://github.com/mjad218/next-js-13-head-bug

To Reproduce

Clone the repo and run the dev server.

@mjad218 mjad218 added the bug Issue was opened via the bug report template. label Nov 11, 2022
@balazsorban44
Copy link
Member

Thanks for the report, although this is a known issue currently and a workaround is documented here: https://beta.nextjs.org/docs/routing/pages-and-layouts#modifying-head

Warning: Currently, the export does not re-render on client-side transition using next/link, only on initial render and reloads. To work around this for <title>, you can use a client component with useEffect that updates document.title. We plan to fix this in a future release.

@balazsorban44 balazsorban44 added Metadata Related to Next.js' Metadata API. area: app App directory (appDir: true) labels Nov 11, 2022
@mjad218
Copy link
Author

mjad218 commented Nov 11, 2022

Thank you,

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: app App directory (appDir: true) bug Issue was opened via the bug report template. Metadata Related to Next.js' Metadata API.
Projects
None yet
Development

No branches or pull requests

2 participants