711 Commits

Author SHA1 Message Date
Delba de Oliveira f18b756cde Docs IA 2.0: Add examples to layout.js (#79453)
In the **layout.js** API reference, we talk about the limitations of
layouts but don't provide alternative examples. This simplifies the
wording, and adds examples using the recommended APIs.

Also adds more general `layout.js` examples.

Part of:
https://linear.app/vercel/issue/DOC-4696/routing-section-layouts-and-templates

Follow up: Look into template.js

---------

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-05-27 10:02:17 +01:00
Delba de Oliveira 72f5429fe0 Docs IA 2.0: Add i18n guides (#79391)
Closes:
https://linear.app/vercel/issue/DOC-4682/guide-internationalization-i18n
Redirects: https://github.com/vercel/front/pull/45963
2025-05-21 15:43:02 +01:00
Jiwon Choi 6258af666b docs: add missing links and imports to cacheLife and cacheTag for prerender-missing-suspense error (#79247)
One of the important resources for this message is `cacheLife` and
`cacheTag`, but the links were missing, and the snippet omitted imports,
which newcomers won't know how to import unless looking up.
2025-05-15 21:28:50 +02:00
Delba de Oliveira 9c757f6d5c Docs IA 2.0: Server and Client Components (#79143)
Closes: 
- https://linear.app/vercel/issue/DOC-4655/client-components
- https://linear.app/vercel/issue/DOC-4656/server-components
- https://linear.app/vercel/issue/DOC-4657/composition-patterns

Redirects: https://github.com/vercel/front/pull/45564

This PR:

- Adds new **Server and Client Components** page to **Getting Started**
   - Explains how Server and Client components are rendered 
   - Clarifies when to use them
   - Reviews and simplifies composition patterns (examples)
- Improves the **How does PPR work** section in light of static,
dynamic, and streaming.
2025-05-15 14:26:19 +01:00
Delba de Oliveira 04a19c1260 docs: Move Edge Runtime information to API reference (#79152)
Closes: https://linear.app/vercel/issue/DOC-4658/edge-runtime
Redirects: https://github.com/vercel/front/pull/45645

---------

Co-authored-by: Lee Robinson <lee@leerob.com>
2025-05-14 12:35:09 +00:00
Delba de Oliveira f3ad435ff3 docs: Merge CSS pages (#78996)
Closes: https://linear.app/vercel/issue/DOC-4648/css
Redirects: https://github.com/vercel/front/pull/45417

- Improves the CSS content for clarity and brevity. 
- Adds Pages Router examples.

---------

Co-authored-by: Lee Robinson <lee@leerob.com>
2025-05-12 08:32:57 -05:00
Delba de Oliveira 3bf570d84d Docs IA 2.0: Images (#78769)
Closes:
- https://linear.app/vercel/issue/DOC-4626/images
- https://linear.app/vercel/issue/DOC-4610/split-image-and-font-pages

Redirects: https://github.com/vercel/next.js/pull/78769

**Housekeeping:** 
- Deletes BYA images page
- Creates relevant getting started docs in `/pages`
- Splits "Images and Fonts" into "Images" and "Fonts" pages to allow us
to add more context to each page in the future

**API reference**: 
- Improves image API reference to follow more of a consistent format and
language
- Adds examples

**Follow-up:** https://github.com/vercel/next.js/pull/78857
- Create a Deep Dive Guide on how image optimization works

---------

Co-authored-by: Rich Haines <hello@richardhaines.dev>
2025-05-08 13:11:38 +01:00
Delba de Oliveira 6e3af1b0fe Docs IA 2.0: Fonts (#78899)
Closes: https://linear.app/vercel/issue/DOC-4641/fonts
Redirects: https://github.com/vercel/front/pull/45242
2025-05-07 10:09:12 +01:00
Josh Story f0f0e4bf5a [dynamicIO] Disallow only dynamic metadata (#78576)
stacked on #78575 

When I changed the dynamic validation rules to be based on the existence
of a static shell I removed an important protection for apps that have
static metadata. Now that metadata is implicitly rendered within a
Suspense boundary it is always opted into allowing dynamic. For dynamic
and partially static pages this is fine because we are going to be
generating a response per request anyways. But if you have a fully
static page and then later accidentally make your metadata dynamic your
page will deopt to partially static without any warning.

This change reintroduces the heuristic where if the only dynamic thing
on the page is metadata the build errors. If there is at least one other
dynamic thing on the page then dynamic metadata is allowed.

A similar change is not necessary for viewport because that is never
rendered in a Suspense boundary and the only way to have dynamic
viewports is to opt the entire app into dynamic with a Suspense boundary
around your root layout
2025-04-27 14:34:36 -07:00
Delba de Oliveira 354b255d91 docs: Move Sass and CSS-in-JS pages to guides (#78536) 2025-04-25 08:16:35 -05:00
Delba de Oliveira 93a9e97c71 Docs IA 2.0: Create public folder API reference (#78531)
Closes: https://linear.app/vercel/issue/DOC-4604/public-folder

- Renames "Static Assets" page to "Public Folder" and moves it to the
file-system conventions section.

Redirects: https://github.com/vercel/front/pull/44623
2025-04-25 08:08:57 +01:00
Delba de Oliveira 76ade73def docs: Move optimizing pages to guides (#78500) 2025-04-24 13:40:54 -05:00
Delba de Oliveira 7a64ada1ab docs: Move pages from Config section into guides (#78496) 2025-04-24 07:28:50 -05:00
Jiwon Choi fd438787f3 misc: use correct capitals for React terms (#78445)
- `Client/Server Component`
- `React Hooks`

---------

Co-authored-by: Sebastian "Sebbie" Silbermann <sebastian.silbermann@vercel.com>
2025-04-23 21:50:55 +09:00
Delba de Oliveira 74d999e06d docs: Move CI build caching page under guides, and create equivalent /app guide (#78416)
Closes: https://linear.app/vercel/issue/DOC-4577/ci-build-caching
Redirects: https://github.com/vercel/next.js/pull/78416
2025-04-22 10:18:39 -05:00
Delba de Oliveira d5359765dd docs: Move Static Exports to guides, create Self-hosting guide (#78244)
Closes: 

- https://linear.app/vercel/issue/DOC-4550/static-exports
- https://linear.app/vercel/issue/DOC-4551/self-hosting

Redirects: https://github.com/vercel/front/pull/44237

---------

Co-authored-by: Lee Robinson <lee@leerob.com>
2025-04-22 08:44:58 -05:00
Delba de Oliveira bd0da32a68 Docs IA 2.0: Move migration docs under Guides (#78193)
Closes: https://linear.app/vercel/issue/DOC-4540/migration-guides

Redirects: https://github.com/vercel/front/pull/44177

Please merge this one first:
https://github.com/vercel/next.js/pull/78189
2025-04-15 15:39:01 +00:00
Delba de Oliveira ae1cad07dd Docs IA 2.0: Move version upgrade docs under Guides (#78189)
Closes: https://linear.app/vercel/issue/DOC-4539/version-upgrade-guides

Redirects: https://github.com/vercel/front/pull/44175

Move version upgrade guides under `Guides`. Also creates a guides
section under the Pages docs.
2025-04-15 16:00:54 +01:00
Josh Story c24c4ac3f5 [dynamicIO] Model invalid dynamic on empty shells (#77270)
Dynamic is disallowed unless a Suspense boundary is above it. This now
applies to metadaata (though this shouldn't matter because it now
streams) and viewport. To allow for fully dynamic routes including
viewport you must put a Suspense boundary around your root layout.
2025-04-14 13:45:14 +02:00
Steven c010ecb237 Revert "docs: revert image 15.3 change until live" (#77977)
Reverts vercel/next.js#77941
2025-04-09 08:32:36 -07:00
Jiwon Choi b9620e6b1f docs: improve file tree (#77889)
The file tree can be improved and share the same convention:

- Use the `txt` file extension.
- One tab indented.
- Use file tree with root `.` and trailing slash for folders.

x-ref: https://tree.nathanfriend.io
2025-04-09 12:53:44 +02:00
Lee Robinson 27bb7066dc docs: revert image 15.3 change until live (#77941) 2025-04-08 12:54:25 -05:00
Steven c9e238edf9 feat(next/image): support new URL() for images.remotePatterns (#77692)
Configuring `remotePatterns` can be a hassle because you have to define
each of the parts. And if you forget a part, its a wildcard meaning it
will match anything. This is usually not desirable since most remote
images don't allow query strings.

This PR adds support for using an array of `URL` objects when defining
`images.remotePatterns`.

```js
module.exports = {
  images: {
    remotePatterns: [
      new URL('https://res.cloudinary.com/my-account/**'),
      new URL('https://s3.my-account.*.amazonaws.com/**'),
    ],
  },
}
```

Note that wildcards must be explicit and anything missing is assumed to
no longer match.
2025-04-02 19:13:57 -04:00
Sam Ko 8dd0b56fb6 docs(errors): update suppressHydrationWarning section (#76521)
## Why?

We should clarify that React will **not** attempt to patch mismatched text content when using `suppressHydrationWarning`.

- Related: https://github.com/reactjs/react.dev/pull/7651
- x-ref: https://github.com/vercel/next.js/discussions/75890
2025-02-26 12:11:59 -08:00
Sam Ko d55c00d842 docs(errors): minor update to failed-to-find-server-action error page (#76296)
## Why?

Follow up to https://github.com/vercel/next.js/pull/75678#discussion_r1964355401.
2025-02-20 13:57:36 -08:00
Sam Ko beb1f72e6d docs(errors): add failed-to-find-server-action error page (#75678)
## Why?

We should also have an error page when somebody gets this error → https://github.com/vercel/next.js/blob/d70cac3eb4dee1d1361629d1b4c765365f184e26/packages/next/src/server/app-render/action-handler.ts#L1086.
2025-02-20 12:31:59 -08:00
Maxim Evtush 173a461ef7 fix: typos in documentation files (#75816) 2025-02-11 21:04:37 -06:00
JJ Kasper 2e114e44c5 Fix linting between lint-check and lint-staged (#74503) 2025-01-03 23:17:14 +00:00
Steven d70595e5b6 feat(next/image): add support for images.qualities in next.config (#74257)
This PR adds support for `images.qualities` configuration which is an
allowlist of qualities that can be used with the quality prop on the
Image component.

- Depends on https://github.com/vercel/vercel/pull/12792
2025-01-03 20:43:29 +00:00
Steven 2a25cbdd99 chore(docs): add missing search: '' on remotePatterns (#73925)
We typically add `search: ''` on `remotePatterns` to disallow the query
string, which is the most common case.

There were a few missing places in the docs so this PR fills in those
gaps.
2024-12-13 17:05:47 -05:00
Delba de Oliveira 26e8b765ae Docs clean up: Merge and delete content from routing/index.mdx (#73859)
Please merge this PR first: https://github.com/vercel/next.js/pull/73858

Closes: https://linear.app/vercel/issue/DOC-4049/delete-routingindexmdx

The content for this page has already been moved to the `Getting
Started` section or `API Reference`.

---------

Co-authored-by: Rich Haines <hello@richardhaines.dev>
2024-12-13 13:16:26 +00:00
Hendrik Liebau 7db3bf73cb Fix unstable_allowDynamic when used with pnpm (#73732)
When using dependencies in Middleware that make use of dynamic code evaluation, Next.js emits a build error because this is not supported in the Edge runtime.

In rare cases, when the code can not be reached at runtime and can't be removed by tree-shaking, users might opt in to using the `unstable_allowDynamic` config.

When combined with pnpm, the provided glob patterns as documented at https://nextjs.org/docs/messages/edge-dynamic-code-evaluation#possible-ways-to-fix-it did not match correctly because of pnpm's use of the `.pnpm` directory.

To fix the pattern matching, we need to provide the `dot` option to [picomatch](https://github.com/micromatch/picomatch), which enables dotfile matching.

_Side note: Ideally we would detect dynamic code evaluation after tree shaking, to reduce the number of cases where users need to revert to using `unstable_allowDynamic`._

fixes #51401
2024-12-10 22:14:40 +01:00
Ahsan Moin 13880d37d2 docs(typo): fix typos in file conventions, functions, and errors (#73376)
`occured` -> `occurred`
`compatability` -> `compatibility`

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-12-03 14:01:38 +00:00
LioRael f8fddfa1dd docs: add await before headers() and cookies() calls (#73315) 2024-11-28 15:19:47 +01:00
Jam Balaya 2a4bdbd4ab docs: fix code block language (#72839)
## Summary
Change `jsx` to `diff` in
[next-dynamic-api-wrong-context](https://github.com/vercel/next.js/blob/canary/errors/next-dynamic-api-wrong-context.mdx)
error page.

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening
the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution
follows the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-19 09:58:44 +00:00
Jam Balaya 6f4352993d docs: add and unify notes to error pages (#72838)
## Description
Unify the note format according to the [contribution
guide](https://nextjs.org/docs/community/contribution-guide#notes).
In addition, add missing bullet points to useful links.

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening
the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution
follows the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-19 09:44:42 +00:00
Jam Balaya f5ead56cb4 docs: add the section titles to error page (#72942)
## Summary
Add the paragraph name to
[next-prerender-crypto](https://github.com/vercel/next.js/blob/canary/errors/next-prerender-crypto.mdx)
error page like [other next-prerender
pages](https://github.com/vercel/next.js/blob/canary/errors/next-prerender-current-time.mdx).

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening
the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution
follows the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-19 09:00:36 +00:00
Jam Balaya e5ce54de0b docs: use relative urls (#72941)
## Description
Follow up #52038.
Remove `https://nextjs.org` from URL in [error
pages](https://github.com/vercel/next.js/tree/canary/errors).

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening
the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution
follows the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-19 08:58:29 +00:00
y-yagi 016b033aaa Fix broken link to the rootDir doc (#72893)
### What?

Fix broken link to the `rootDir` doc at
https://nextjs.org/docs/messages/no-html-link-for-pages#options

### Why?
This is because there is an extra space between a path and an anchor. 

### How?

This PR removes it to fix the format.

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-19 08:50:01 +00:00
Jam Balaya 20dc57391e docs: fix code block language in error pages (#72943)
## Summary
Update code block language in [error
pages](https://github.com/vercel/next.js/tree/canary/errors).

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening
the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution
follows the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-19 07:56:55 +00:00
Jiwon Choi c469404824 improve no-img-element lint error message (#72410)
### Why?

To customize Image Optimation, the user can use a custom loader, but
that information was out from the related lint error message.

Closes NDX-181
2024-11-12 21:48:12 +09:00
Jam Balaya 691eeae8fb docs: unify the header deps by removing # (#72451)
## Description
Follow up #72391.
I missed some error pages.

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening
the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution
follows the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-08 11:20:34 -08:00
Delba de Oliveira 0b35ddd825 Docs: Move next.config.js API pages under a config folder, fix headings in TS and ESLint config pages (#72465)
This PR:

- Moves `next.config.js` options under a "config" folder which includes
references for other configuration such as the ESLint plugin. I figure
it would be tidier than having "Next.config.js Options" and "Config" in
the API reference.
- Fixes the issue with the "config" folder not showing up in canary:
https://linear.app/vercel/issue/DOC-3749/bug-figure-out-why-new-config-folder-isnt-showing-up-in-the-canary
- Fixes the indentation issues and missing example header (caused by an
invisible character).

Redirects: https://github.com/vercel/front/pull/38704
2024-11-08 14:48:55 +00:00
Jam Balaya 74a19b7467 docs: unify the header deps by removing # (#72391)
## Summary
Remove redundant `#` from [error
pages](https://github.com/vercel/next.js/tree/canary/errors).

## Description
Follow up #52038 and #72263.
Updated
[template.txt](https://github.com/vercel/next.js/blob/canary/errors/template.txt)
and clarified the header deps.
Then rewrite as per the template.

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening
the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution
follows the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-07 08:58:43 +00:00
Mayur fbb3a766e7 Update Cloudflare Auto Minify link due to feature deprecation (#72417)
This PR updates the link for the Cloudflare Auto Minify feature, as it
has been deprecated. Cloudflare now recommends disabling this feature to
avoid potential issues. The link and related references have been
modified to reflect this update and ensure accurate information for
users.

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-07 08:52:56 +00:00
Delba de Oliveira fa8d558154 Docs: Split Getting Started between App and Pages, improve Installation page (#72178)
Prepare **Getting Started** Section for upcoming changes, and work on
the first page: `Installation`.

Closes: 
-
https://linear.app/vercel/issue/DOC-3703/update-how-getting-started-is-handled-in-next-site
-
https://linear.app/vercel/issue/DOC-3694/page-how-to-set-up-a-new-nextjs-project-installation
- https://linear.app/vercel/issue/DOC-3707/create-subsection-for-plugins
- https://linear.app/vercel/issue/DOC-3709/eslint-plugin-api-reference
- https://linear.app/vercel/issue/DOC-3710/typescript-reference-page

### Key Changes: 

- Duplicate Getting Started Section between App and Pages Router docs 
- Since getting started will vary between the routers, each docs needs
to have their own Getting Started section
- Reorganize folder numbers
   
**Installation Page**: 
- Split app and pages router specific information
- Rename "Installation" to "How to set up a Next.js application" for SEO
- Add setup instructions for **TypeScript**
- Add setup instructions for **ESLint**
- Add setup instructions for **Absolute Imports and Module Path
Aliases**

**Side effects from moving content around**:
- Create a subsection in API Reference called **Configuration**. 
   - Add ESLint Plugin page, and update it to follow template
   - Add TypeScript page, and update it to follow template
- Remove the **Absolute Imports and Module Path Aliases** page, it's
small enough to live under the set up instructions.

---------

Co-authored-by: Rich Haines <hello@richardhaines.dev>
2024-11-06 12:32:05 +00:00
Delba de Oliveira 8f99ab20ae Docs: Remove legacy tags from unstable_cache and unstable_noStore (#72134)
This was a premature move as the docs made their way into the stable
version. Can't risk these being merged just yet, and they're also not in
canary.
2024-11-06 08:35:52 +00:00
Rich Haines 974767e42d Fix code examples in error page (#72259)
This PR fixes the code examples in the Next prerender missing suspense
error page

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-06 08:16:56 +00:00
Jam Balaya ed239c40b5 docs: update error template.txt (#72263)
## Summary
Update [error
template.txt](https://github.com/vercel/next.js/blob/canary/errors/template.txt)
following #52038 changes.

## Description
1. Remove errorId header
2. Section header is double sharp `##` instead of four sharp `####`

### Adding or Updating Examples

- [x] The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- [x] Make sure the linting passes by running `pnpm build && pnpm lint`.
See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-06 08:16:40 +00:00
Jam Balaya 2d549683a6 docs: change runtime value in example code (#72274)
## Description
[Invalid Page / API Route
Config](https://nextjs.org/docs/messages/invalid-page-config) shows some
examples.
However, runtime examples are same `nodejs` runtime.
Then I add `edge` value instead of duplicate value.

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening
the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution
follows the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-06 08:16:38 +00:00