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

Docs: Explain why Layouts (RSCs) can't access pathname #64785

Merged
merged 18 commits into from
Apr 25, 2024
Merged

Conversation

delbaoliveira
Copy link
Contributor

@delbaoliveira delbaoliveira commented Apr 19, 2024

  • Add section explaining why pathname can't be accessed in a layout (file)
  • Split pages and layouts files (to add layout-specific examples in the future)
  • Clean up the existing active links example

I'll add layout-specific examples in a follow-up PR, after creating some demos.

- Add examples of common layout / templates patterns
@ijjk ijjk added created-by: Next.js Docs team PRs by the Docs team. Documentation Related to Next.js' official documentation. labels Apr 19, 2024
@delbaoliveira delbaoliveira changed the title WIP: Add examples for pathname patterns in Layouts Docs: Explain why Layouts (RSCs) can't access pathname Apr 23, 2024
Copy link
Contributor

github-actions bot commented Apr 23, 2024

All broken links are now fixed, thank you!

@ijjk ijjk added the Font (next/font) Related to Next.js Font Optimization. label Apr 23, 2024
@ijjk ijjk added the examples Issue/PR related to examples label Apr 24, 2024
@delbaoliveira delbaoliveira marked this pull request as ready for review April 24, 2024 08:21
@delbaoliveira delbaoliveira requested review from a team as code owners April 24, 2024 08:21
Copy link
Member

@samcx samcx left a comment

Choose a reason for hiding this comment

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

Looks good to me!

I'm not sure you want others to :review: as well, but could not find anything off myself. :lgtm:

@delbaoliveira delbaoliveira merged commit 84af800 into canary Apr 25, 2024
39 checks passed
@delbaoliveira delbaoliveira deleted the docs-8dhs branch April 25, 2024 07:44
@karlhorky
Copy link
Contributor

@delbaoliveira thanks for documenting this! One of the first things that a lot of people run into when trying out the App Router.

If some examples of best practice patterns for common things could be added, that would be amazing, eg:

  1. how to highlight the current page in a nav (I'm guessing with a Client Component?)

@karlhorky
Copy link
Contributor

@delbaoliveira
Copy link
Contributor Author

Hey @karlhorky 👋🏼 Nice to see you here!

Ah yes, I'll add a few more examples to the docs in the coming days. This Github issue has some good suggestions, it would be good to show how people can achieve these patterns: #43704

I'm also writing a response for that issue that goes into more detail into why.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
created-by: Next.js Docs team PRs by the Docs team. Documentation Related to Next.js' official documentation. examples Issue/PR related to examples Font (next/font) Related to Next.js Font Optimization. locked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants