Commit graph

682 commits

Author SHA1 Message Date
Jan Amann
6eabef68cd
Add next-intl example (#21447)
I've recently built an i18n library that is tailored to usage in Next.js: [next-intl](https://github.com/amannn/next-intl). It complements the internationalized routing capabilities of Next.js by managing translations and providing them to components, as well as handling date and time formatting. It's a bit young, but I'm using it in two production apps now and I'm quite confident in the library.

Would you want to include an example and link to it?
2021-04-19 19:58:36 +00:00
Jasper Moelker
76184ab0ca
docs: fix a11y router examples (#23031)
Non-interactive elements such as a `<span>` should not have event bindings as they are not accessible by everyone.
This fix solves this issue by replacing it with a `<button>` which is suitable for interaction.
Since a button defaults to `type="submit"` the button also explicitly has a `type="button"` to prevent accidental form submits (all examples aim to navigate, not to submit a form).

[More background on this a11y best practice](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/no-static-element-interactions.md)
2021-04-19 19:42:52 +00:00
JJ Kasper
d2b0d43eb9
Update incremental adoption in rewrites doc (#24186)
This updates the incremental adoption section in the rewrites docs to mention the new fallback rewrites instead of the no-op rewrite and also points to the incrementally adopting Next.js doc. 

## Documentation / Examples

- [x] Make sure the linting passes

Closes: https://github.com/vercel/next.js/pull/23700
Closes: https://github.com/vercel/next.js/issues/23699
2021-04-18 08:26:08 +00:00
Julien Benchetrit
646a881183
Docs update: Redirect paths with parentheses (#24062)
It took me quite a while to understand that in order to redirect from `/english(default)/:path` to `/en-us/:path`, I have to escape the parentheses in the source with double backslashes so I thought I'd suggest it as a small doc update.


## Documentation / Examples

- [x] Make sure the linting passes
2021-04-17 19:40:35 +00:00
Steven Tey
6e22a440e2
Updated prefetch documentation (#24171)
Added the fact that when `prefetch` is set to `false`, Next will prefetch the link when an `onMouseEnter` is triggered. Response to issue #11793



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [X] Make sure the linting passes

Closes: https://github.com/vercel/next.js/issues/23525
2021-04-17 16:08:06 +00:00
Marc van Gend
b7a12655e2
Document the need to call App.getInitialProps() from a custom app's getInitialProps (#24002)
Document the need to call App.getInitialProps() from a custom app's getInitialProps. See https://github.com/vercel/next.js/issues/23055.
2021-04-16 14:54:02 +02:00
Lee Robinson
279e105279
Update .now.sh to .vercel.app. (#22359) 2021-04-14 09:46:06 -05:00
Alex Vilchis
8df5fc5a8e
docs: Fix TypeScript casing (#24040) 2021-04-14 08:16:20 +00:00
JJ Kasper
4d291bd810
Use regex lexer for gathering named groups from has (#23626)
This is a follow-up to https://github.com/vercel/next.js/pull/23588 to update to use a regex lexer to gather the named regex groups instead of attempting to gather them through executing the regex since it can fail to gather the regex groups when they are using specific matching. This also ensures we don't pass the value as a segment when value is defined and it doesn't use a capture group. Additional tests are added to cover these cases and documentation updated to reflect this. 

Closes: https://github.com/vercel/next.js/issues/23415

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

## Documentation / Examples

- [x] Make sure the linting passes
2021-04-13 12:34:51 +00:00
Angel Gomez
9a548b649f
Add missing import in CSS docs (#24007)
This is a one-line commit, which adds the missing import for VisuallyHidden component, from Reach UI, to the CSS documentation in the Dialog component example.
2021-04-13 08:49:55 +00:00
JJ Kasper
de567d91d7
Update incremental migration doc and add version for new rewrites (#23859)
This updates the incremental migration doc to mention the new fallback rewrites over the previous no-op rewrite behavior. This also mentions the version the new rewrites modes were added to the rewrites doc.  

## Documentation / Examples

- [x] Make sure the linting passes
2021-04-09 18:59:59 +00:00
JJ Kasper
1cf7360788
Add experimental note to docs for has (#23835)
This adds a note the `has` documentation mentioning the feature is still experimental as we currently show a warning when the feature is used stating the same. 

## Documentation / Examples

- [x] Make sure the linting passes
2021-04-08 18:39:25 +00:00
Pierre Berger
bce78ba89c
Fix upgrading broken link (#23785)
Fix a broken link in the [upgrading documentation](https://github.com/vercel/next.js/blob/canary/docs/upgrading.md).
2021-04-08 10:15:37 +00:00
Turadg Aleahmad
7f6a74a8e2
docs: Update built-in-css-support.md with Linaria example (#23333)
add link to Linaria example
2021-04-07 23:20:03 +00:00
Tim Neutkens
d2dc91c80c
Add note about prefetching (#23732)
Fixes #23687



## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [x] Make sure the linting passes
2021-04-07 16:07:32 +00:00
Sam Robbins
4de984ca23
Update router.md to improve a11y (#23611)
Code examples used `span`, change to use `button` for better accessibility 

## Documentation / Examples

- [x] Make sure the linting passes
2021-04-01 18:26:19 +00:00
Joe Haddad
eecc3342cb
Temporarily remove experimental ESLint integration (#23521)
This pull request **temporarily** removes ESLint, as it was not landed in accordance with our standard experimental policies. We are fully committed to landing this change again.

This is being reverted because:

- Next.js has very strict goals for its install size. This feature resulted in adding over 17MB, or a 43.6% increase.
- The feature was not first landed under the `experimental` key in `next.config.js`, rather, it was added under the stable namespace (top-level)
- Using the feature doesn't do a "guided setup" like TypeScript, it should ask you to "bring your own" dependencies for ESLint
- It uses a undesirable ESLint plugin name: `plugin:@next/next/recommended`. This should read out as strictly `next`, or as short as we can get it.
- Does not provide actionable warnings (missing link to resolve issue)
- Does not follow appropriate console output styling. We need to revisit how these are presented.

To re-land this, we need to ensure the following minimums are met:
- Very minor change in install size
- Fully experimental (i.e. flagged) with warnings
- Finalized package name and configuration shape, preferably so we can do ` { extends: 'next' } `.
2021-03-30 08:26:35 +00:00
Lee Robinson
d4d611119e
Fix YAML parsing issue in ESLint docs. (#23511) 2021-03-29 17:59:51 +02:00
Tim Neutkens
b34a0c98fa
Update err.sh links to use nextjs.org/docs/messages instead (#23353) 2021-03-29 10:25:00 +02:00
Lee Robinson
d49f978a17
Update with-docker example and deployment docs. (#23486)
## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [x] Make sure the linting passes
2021-03-28 20:32:09 +00:00
Jiachi Liu
737c25edd8
doc: fix ActiveLink detection condition (#23472)
## Documentation / Examples

- [x] Make sure the linting passes


`router.pathname` can be dynamic routes like `/posts/[slug]`, use `router.asPath` instead to detect anchor is active
2021-03-28 14:17:50 +00:00
Lee Robinson
5ac8951ed9
Update babel docs to mention you can use babel.config.js. (#23434)
## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [x] Make sure the linting passes
2021-03-26 16:01:22 +00:00
JJ Kasper
d130f63c41
Add handling fo beforeFiles, afterFiles, and fallback rewrites (#23407)
This adds support for returning an object from `rewrites` in `next.config.js` with `beforeFiles`, `afterFiles`, and `fallback` to allow specifying rewrites at different stages of routing. The existing support for returning an array for rewrites is still supported and behaves the same way. The documentation has been updated to include information on these new stages that can be rewritten and removes the outdated note of rewrites not being able to override pages. 



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
2021-03-26 15:19:48 +00:00
JJ Kasper
75c721c583
Add has route field (#22341)
This adds support for a `has` field to `rewrites`, `redirects`, and `headers` to allow matching against `header`, `cookie`, and `query` values. Documentation and additional tests for the feature is also added in this PR. 

Closes: https://github.com/vercel/next.js/issues/22345
2021-03-24 16:50:16 +00:00
matamatanot
5c7475a6e8
Fix typo in eslint doc (#23338)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
2021-03-24 02:03:51 +00:00
Houssein Djirdeh
e5ef60fecb
Add ESLint to Next.js (#22437)
For #22228

This PR:

- Adds ESLint to toolchain
  - Included by default for builds (`next build`)
  - Can be enabled for development (`next dev`)
  - Custom formatter built for output
- Adds appropriate tests
- Adds two documentation pages
2021-03-23 21:32:42 +00:00
Mito
46fc696840
Include useEffect in SPA demo import, Fix punctuation (#23256)
Under the Single-Page App (SPA) heading, there is a code snipped which has a missing import:
import { useState } from 'react'
to
import { useState, useEffect } from 'react'

Also added apostrophe to description:
your old application entry point
to
your old application's entry point



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [X] Make sure the linting passes
2021-03-22 01:35:04 +00:00
Tim
a1b97ac3f8
Added Prepr CMS Examples to docs (#23221)
Following commit 1f5c2c8513

Adding documentation links to example.

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [X ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [x ] Make sure the linting passes
2021-03-19 16:10:35 +00:00
Lee Robinson
115674f6a4
Clarify a custom server doesn't mean you can't use an existing backend. (#23200)
I've been this confusion quite a few times.

> So with my requirements, how big of a sin is it to use Next only for the frontend and get all its data, JWT tokens, etc. from my NodeJS backend by calling its respective APIs to said backend?

> Even the docs mention that running a custom server is not a great idea...
2021-03-18 17:31:44 +00:00
Vincent Voyer
1b020e6cd1
docs(authentication): rephrase next-iron-session/next-auth (#23199)
I thought that the current wording was not accurate both for next-iron-session and next-auth.

- next-auth is a full-featured authentication system like passport
- next-iron-session is a session utility

The previous copy was less clear about that and, for example, said you should go for next-iron-session for user/password and next-auth for everything else. Which is not the case. I use next-iron-session with only a Slack login, and you can implement email/password with next-auth.

Hope you like it!

PS: I have no preference between the two, I think they serve a different purpose. I used the two (and authored one).

I used next-auth on https://sourcekarma.vercel.app/
2021-03-18 17:04:58 +00:00
Tim Neutkens
70d306e0ac
Add note about multiple requests when using incremental static generation (#23190) 2021-03-18 16:22:29 +01:00
Josh Flayhart
34e9409770
[Docs] Update next.config.js link to default config (#22989)
It's currently misleading and I chose to freeze to a particular version since pointing to canary every time is likely to break (as is happening prior to this PR).

The link will now go to: https://github.com/vercel/next.js/blob/v10.0.8/packages/next/next-server/server/config-shared.ts#L33
2021-03-17 20:21:39 +00:00
Lee Robinson
f3cbdf0b02
Document how to use basePath with next/image. (#23123)
Supersedes https://github.com/vercel/next.js/pull/23115 for more clarity and a better recommendation.
2021-03-16 19:56:41 +00:00
Shane Rogers
308c2beca2
Add image base path configuration option (#23115)
I similarly [couldn't find this info](https://github.com/vercel/next.js/issues/19711#issuecomment-750414110) in the docs about configuring the image path when using an app `basePath`, so thought I'd add it.
2021-03-16 17:13:24 +00:00
Abdullah Mzaien
e36eb381da
Duplicate scroll description (#23103)
- `scroll` - Optional boolean, controls scrolling to the top of the page after navigation. Defaults to `true` and 
  - `scroll`: Scroll to the top of the page after a navigation. Defaults to `true`
as options for router.push
2021-03-16 16:39:14 +00:00
Lee Robinson
9431439c6d
Add note about next/export to Image Optimization docs. (#23088)
https://github.com/vercel/next.js/discussions/19065#discussioncomment-484842
2021-03-16 01:05:14 +00:00
Alex Safian
3063d3b8ff
Update pages.md (#23064)
The `path` variable must be an array of objects which has a `params` key. This code will prevent reader confusion.
2021-03-15 02:44:58 +00:00
Kenneth Lum
2af5a0e47c
it is props: { posts } (#23004)
changing `props: posts` to `props: { posts }`
2021-03-12 08:11:01 +00:00
Kenneth Lum
e7a22afe2f
When there is data already, the props is props: { data } (#23003)
When there is data already, the props is props: { data }
Would be better if the `props: { }` part is `props: { data }`
2021-03-12 08:03:10 +00:00
JJ Kasper
62967fc667
Add note for loading env files during testing (#22982)
This adds a note to the environment variables documentation to mention how the env files can be loaded using the `@next/env` package as this has been brought up a few times. 

x-ref: https://github.com/vercel/next.js/issues/22936#issuecomment-796665303
x-ref: https://github.com/vercel/next.js/issues/17903
2021-03-12 00:47:42 +00:00
Lee Robinson
fa02b197f5
Fix typo in source maps documentation. (#22952) 2021-03-10 16:41:01 +00:00
JJ Kasper
e9a1d8fd42
Add documentation for new static 500 behavior (#22888)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-03-09 12:45:31 +01:00
Yuki Takemoto
635a98e2fd
Fix typo (#22891)
This PR fixed a typo in api reference.
2021-03-09 01:37:52 +00:00
Jason Emery
81b05256dd
Update router.md (#21899)
include scroll option documentation for router.push
2021-03-08 13:52:37 +00:00
Sebastian Andil
87ccebf5fd
Update module-path-aliases.md (#22739)
Add note about restarting dev server on changes to tsconfig / jsconfig
2021-03-08 14:19:31 +01:00
JJ Kasper
ce400b2678
Update NEXT_LOCALE cookie note (#22736)
This updates the `NEXT_LOCALE` cookie docs to mention how it is used for redirecting from `/` more specifically. 

x-ref: https://github.com/vercel/next.js/pull/20045#discussion_r586158535
2021-03-03 19:30:01 +00:00
Lee Robinson
006eba3225
Add note for using getStaticProps with 404.js (#22693)
Help clarify that this option is available!
2021-03-02 17:09:54 +00:00
Lee Robinson
b874bc7f82
Add note about preloading to routing introduction. (#22656)
Preloading is mentioned in the `next/link` docs, but not in the routing introduction.
2021-03-02 03:17:43 +00:00
Ålex
5b0ed99093
Fix grammar in next/amp API reference (#22653)
Change 'an' of "The page has an user-accessible" to 'a'.
2021-03-02 00:33:09 +00:00
dominicfraser
86ce29b34a
Update authentication.md SSR example (#22641)
There are two examples, one (a) for "Authenticating Statically Generated Pages" and one (b) for "Authenticating Server-Rendered Pages".

(a) uses a sudo `useUser` hook to fetch the user client-side.

It looks like the example for (b) was copied and pasted then edited from (a), but in (b) this `useUser` hook is not used (instead using `req.session.get('user')`).

This PR simply removes the unused import in the (b) example.
2021-03-01 16:44:32 +00:00
Lee Robinson
eb79218b7d
Add note about other redirects to next.config.js docs. (#22640)
In case a user lands on this page via search or from Google, we should mention the other ways you can redirect with Next.js.
2021-03-01 16:33:04 +00:00
NkxxkN
293c243ab7
add-supertokens-to-authentication.md (#22223)
Hey team. This PR is a follow up on https://github.com/vercel/next.js/pull/21384 to add a reference to `with-supertokens` example to authentication doc.
2021-03-01 15:53:17 +00:00
Lee Robinson
0a35b578d4
Add use cases for API Routes to documentation. (#22616)
I've seen this confusion come up a few times, specifically [here](https://www.reddit.com/r/nextjs/comments/lsmpon/is_there_a_benefit_to_using_api_when_you_are_only/) for the latest.
2021-03-01 01:15:14 +00:00
devuxer
a289d38057
Simplify code examples for dynamic API routes (#22546)
Deep matching destructuring syntax is hard to understand and read vs. `const { ... } = req.query`.
2021-02-26 18:43:41 +00:00
Slawa Pidgorny
1ba5c0acc7
Add link to TypeScript docs from API Routes section (#22564) 2021-02-26 13:39:16 +00:00
Alex
69fe678ea9
docs(deployment): Update user ownership in docker deployment docs (#22539)
After testing the new docker deployment documentation, ran into the following error when running the container if you're using `next/image`:

```
[Error: EACCES: permission denied, unlink '/app/.next/cache/images/2+fKe4RlpMaSTNc8npKwiCItZgik9aOX9qkxnVSrsUo=/1613616499089.3hEMhfux5+SolMDEVHEaVPK2O0OlcLoYNao0yKpmYeg=.webp'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'unlink',
  path: '/app/.next/cache/images/2+fKe4RlpMaSTNc8npKwiCItZgik9aOX9qkxnVSrsUo=/1613616499089.3hEMhfux5+SolMDEVHEaVPK2O0OlcLoYNao0yKpmYeg=.webp'
}
```

This change gives the user correct ownership to have the correct permissions.
2021-02-25 17:16:10 +00:00
JJ Kasper
d9bb645c03
Mention regex route behavior with i18n (#22500)
This mentions how locale routes are transformed when `locale: false` is not used to explain why regex routes might not match with i18n. 

Closes: https://github.com/vercel/next.js/issues/21507
2021-02-24 19:04:30 +00:00
Lee Robinson
460c7c7ddc
Update deployment docs to mention caveat on next.config.js. (#22480) 2021-02-24 04:21:43 +00:00
Alex
e5bc0cdae0
docs(deployment): Update working directory in builder stage (#22478)
Update docker file example in deploy documentation to use correct working directory in builder stage. It will fail to copy files from that stage since it's attempting to copy files that don't exist.
2021-02-24 03:52:36 +00:00
Armando Magalhães
1253a11971
docs(deployment): Add Docker Image section (#17794)
Add a Docker Image section into the Deployment Documentation with an example and how to build and run it.

The example is a multi-stage docker image with node modules layer caching for faster builds in development and a result image just with the node_modules and build code needed to run the application within a custom user with restricted access.

The example contains a commented piece of code on how to disable telemetry as well.

This is useful for folks that are deploying to container orchestrators like ECS, Kubernetes (GKE, EKS, AKS) or Hashicorp Nomad, as well as just running a docker container in a single node in some cloud provider.
2021-02-24 00:42:15 +00:00
Lee Robinson
fea5c18132
Update docs. (#22358) 2021-02-20 00:49:41 +00:00
JJ Kasper
9793e9004f
Add isPreview field to router (#21638)
This adds an `isPreview` field to the `next/router` to allow detecting when in preview mode. 

Closes: https://github.com/vercel/next.js/issues/14903
2021-02-18 18:34:33 +00:00
Balázs Orbán
6af69793aa
Point to official next-auth example (#22282)
We would like to maintain a single `next-auth` example under our organization. This PR points readers of the Next.js docs to our repository, instead of `with-next-auth`

Also, as @kriscarle pointed out in https://github.com/nextauthjs/next-auth/issues/1132#issuecomment-772375650, we should maybe only maintain a single example to be able to keep it up-to-date more easily.
2021-02-18 15:39:38 +00:00
Mike Jerome
1c3ac0e3eb
Document scroll option for router.push (#22275)
Clarify in the docs that scroll is an option for router.push() and it defaults to true.
2021-02-17 16:02:18 +00:00
JJ Kasper
958bd6cabb
Update server output path in static optimization docs (#21910) 2021-02-05 21:00:03 -06:00
Flavio Wuensche
ee184a11d8
Add example for headers and link in the docs (#21821) 2021-02-05 09:07:22 -06:00
Joe Haddad
cef4b4b153
Revert "Fix docs for sample query parameters" (#21881)
This reverts commit 9a3a0da319.
2021-02-04 20:35:09 -05:00
Sam Holmes
9a3a0da319
Fix docs for sample query parameters (#21879) 2021-02-05 01:17:26 +00:00
Aryan Beezadhur
40065135a5
Docs: delete extra bracket [introduction.md] (#21715) 2021-02-01 06:24:10 +00:00
Lachlan Campbell
e2001db016
Fix “it’s” typo in CRA migration doc (#21678) 2021-01-29 20:58:11 -06:00
Lee Robinson
232209b513
Remove note about Yarn 2 support. (#21665)
My addition of the Yarn 2 caveat was more nuanced than I thought. Apologies. @merceyz has been adding extensive e2e tests for Yarn 2 support. We plan to support Yarn 2 compat.

Reverts https://github.com/vercel/next.js/pull/21657.
2021-01-29 19:09:17 +00:00
Lee Robinson
843252b821
Add note about Yarn 2 support. (#21657)
As we saw some confusion with users trying out Yarn 2 and hitting roadblocks in their app. Yarn 2 is supported on a best-effort basis.
2021-01-29 14:38:19 +00:00
Lee Robinson
5a73859fe8
Update docs and Create Next App to use API Middlewares by default. (#21639) 2021-01-28 23:34:03 +00:00
Ondřej Chrastina
7aa397f32e
Add Kontent example to preview section (#21542)
Kontent example also contains the implementation of the preview capabilities in the example.

Including the example as it is [Data fetching section](https://nextjs.org/docs/basic-features/data-fetching).
2021-01-26 15:00:29 +00:00
mcha
c619f41f92
Doc: pageExtensions - note regarding affected files (#21326)
#21279 

This is just a comment explaining that changing `pageExtensions` not only applies to `pages/*` but other files as well.
2021-01-26 11:49:36 +00:00
Lee Robinson
d82672c397
Add Next.js Analytics to documentation. (#21527) 2021-01-25 19:12:33 +00:00
Faizan Virani
6c51ad96ac
Added Typescript example for withRouter (#18116)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-01-25 14:48:28 +01:00
Justin Smith
8d92010979
Update headers.md to clarify Cache-Control gets overwritten in prod (#19967)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-01-24 17:14:19 +01:00
Dylan R. Johnston
5baedf5567
Update data-fetching.md to use async file loading (#17518)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2021-01-23 17:28:33 +01:00
Tim Neutkens
d991e3c957
Update manifest.json 2021-01-21 15:06:53 +01:00
David Spiessens
0fc46d0b70
Add Note to i18n-routing Docs for Subdomains for Locale Domains (#21387) 2021-01-20 17:08:55 +00:00
Joe Haddad
cfae5c6c32
fix: lint 2021-01-19 00:26:53 -05:00
Lee Robinson
5d98874e8f
Add guide "Migrating from Create React App" (#21212) 2021-01-18 17:37:32 -06:00
Tim Neutkens
c5b5c43e3d
Add codemod for files that do not support the new React JSX transform (#21281)
Previously our automatic React injection approach injected `import React from 'react'` automatically whenever JSX was detected. The new official JSX transform solves this by enforcing importing `React` when it is used.

This codemod automatically converted files that are using a "global React variable" to use `import React from 'react'`
2021-01-18 15:17:10 +00:00
Lee Robinson
dc87a8436b
Update redirected or broken Vercel docs links. (#21119) 2021-01-14 15:37:21 +00:00
Volodymyr Klymenko
334ce64cd7
Add missing word to Data Fetching docs (#21018)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-01-13 15:35:32 +01:00
Lalit
a6ff7bd661
Update a link (#20999)
Update link from https://swr.now.sh to https://swr.vercel.app
2021-01-13 14:22:29 +00:00
Baheya Khalifa
f9b7a391b7
Fix teeny tiny typo (#21005) 2021-01-12 15:05:32 +00:00
Lee Robinson
e30c5a8eb8
Add "Migrating from React Router" docs. (#20982)
Please let me know if anything is missing from this document 😄
2021-01-12 01:44:14 +00:00
Lachlan Campbell
4d282f929f
Add note on destructuring to Env Variables docs (#20869)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2021-01-11 11:13:24 +01:00
Daniel Stumme
d49c47427b
Adding small note to ENV documentation (#20860)
This single sentence addition would have saved me about a day of troubleshooting. This doc doesn't mention how the inline occurs. The only place I could eventually find that mentions this is the server & public runtime config pages.
2021-01-07 16:54:15 +00:00
Luc Leray
8eaabe2fb0
Fix deploy buttons URLs (#20834)
Fix all deploy button URLs in the Next.js repo to follow the following format:
```
https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/<EXAMPLE_NAME>&project-name=<EXAMPLE_NAME>&repository-name=<EXAMPLE_NAME>
```

The detailed docs for the Deploy Button can be found here: https://vercel.com/docs/more/deploy-button.

Also updates legacy Vercel import flow URLs (starting with vercel.com/import or with vercel.com/new/project), to use the new vercel.com/new URLs.

---

For example, for the `hello-world` example:

The URL is https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/hello-world&project-name=hello-world&repository-name=hello-world

And the deploy button looks like this:
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/hello-world&project-name=hello-world&repository-name=hello-world)

---

For reference, I used the following regexes to search for the incorrect URLs

```
\(https://vercel.com/import/git\?s=https://github.com/vercel/next.js/tree/canary/examples/(.*)\)
\(https://vercel.com/import/git\?c=1&s=https://github.com/vercel/next.js/tree/canary/examples/([^&]*)(.*)\)
\(https://vercel.com/import/project\?template=https://github.com/vercel/next.js/tree/canary/examples/(.*)\)
https://vercel.com/import/git
https://vercel.com/import/select-scope
https://vercel.com/import
https://vercel.com/new/project
```
2021-01-07 01:40:29 +00:00
Shu Uesugi
817cffdcbe
Use vercel.app for blog starter URL (#20820)
Rename https://next-blog-starter.now.sh to https://next-blog-starter.vercel.app (@lfades renamed the domain name)
2021-01-06 18:13:40 +00:00
Tim Neutkens
fb9ca49401
Update static file serving doc to mention Next.js 10 (#20815)
Fixes #20403
2021-01-06 15:21:34 +00:00
Lee Robinson
9afc0f58c4
Add docs for custom image loaders. (#20788)
Docs for https://github.com/vercel/next.js/pull/20216/.
2021-01-06 02:16:09 +00:00
JJ Kasper
f8e44b9425
Add documentation for rewrite params query passing behavior (#20757)
Closes: https://github.com/vercel/next.js/issues/20197
2021-01-05 14:47:08 +00:00
Tim Neutkens
a1a4af2d32 Bring back indicator documentation with a note that the feature has been removed 2021-01-05 12:47:52 +01:00
Jesse Jafa
0d98f370aa
Clarify ctx.query type on getServerSideProps (#20327)
Closes https://github.com/vercel/next.js/issues/19481

The current text implies `query` is a string. IMO it would be better if it clarified that `query` is an object containing the query string's keys and values

Edit:
Relevant docs url: https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering
2021-01-04 21:58:56 +00:00
Tim Neutkens
74166ea7e8
Remove outdated documentation (#20714)
Fixes #20487
2021-01-04 10:45:57 +01:00
Leo Lamprecht
9a0d704f76
Clarify how to use Environment Variables on Vercel (#20708)
Updates the env documentation to mention `.vercelignore` when using the Vercel CLI. Also clears up parts of the other paragraphs and updates the links as these topics now have dedicated pages in the Vercel docs.
2021-01-04 09:42:57 +00:00
Frédéric Montet
98752eb0f1
Update link.md (#20435)
Added the `locale` prop in the Link documentation. At the moment it is only stated in the i18n doc.
2021-01-03 14:48:54 +00:00
JJ Kasper
fad3256091
Update docs for basePath: false rewrite (#20663) 2021-01-01 12:40:25 -05:00
JJ Kasper
3a9d18b549
Add isReady field on router (#20628)
Adds an `isReady` field on `next/router` specifying whether the router fields are updated client-side and ready for use. Should only be used inside of `useEffect` methods and not for conditionally rendering on the server.

Closes: https://github.com/vercel/next.js/issues/8259
Closes: https://github.com/vercel/next.js/pull/9370
2020-12-31 16:54:32 +00:00
Lee Robinson
380afbfba2
Add docs on authentication patterns. (#16277)
Building off [this Slack conversation](https://vercel.slack.com/archives/CGD3XGSD7/p1597329727013900), this PR adds a top-level section to the documentation on authentication patterns.

Please provide any and all comments! A few open thoughts I have:

- ~Should this include code snippets from the related providers or stay very high-level? At what point do we delegate to the examples folder?~ Keep things high level and delegate to examples folder 
- ~Should this include any related cards at the bottom?~ Added to the bottom
- ~Should other places in the documentation link back to here?~ Added link from routing
- Should it be a top-level route, or be underneath advanced?
2020-12-31 08:28:11 +00:00
Joe Haddad
74693810d0
docs: update image docs for consistency (#20621) 2020-12-30 16:33:21 -05:00
Joe Haddad
45b87aa23a
feat(next/image): preload priority images (#20615)
The HTML Living Standard explicitly says `href` should be omitted to prevent the loading of an incorrectly sized image:
https://html.spec.whatwg.org/multipage/semantics.html#attr-link-imagesrcset

![image](https://user-images.githubusercontent.com/616428/103378205-8a013800-4aaf-11eb-9085-10f547263fed.png)

Since it's in the spec, I assume this is valid-enough HTML.

This also dedupes preloads which the old implementation did not.

---

Fixes #18756
x-ref #19118
Fixes #18720
2020-12-30 21:10:28 +00:00
Lee Robinson
a03f1f3847
Add version history for API changes to documentation. (#20604)
Closes https://github.com/vercel/next.js/issues/20036.
2020-12-30 15:06:34 +00:00
matamatanot
d33d1dd00a
Ignore domains option when loader is set (#18447)
```
images: {
    domains: ['example.com'],
    path: 'https://example.com/myaccount/',
},
```
Those `domains` and `path` look a lot alike for me and so, I was confused. I found out that the domains are ignored if the Loader is set, which makes sense.
2020-12-30 01:35:37 +00:00
Daniel Yefet
69ff649999
Remove "priority" prop from Image docs (#20471)
I don't think the docs should still mention the `priority` prop because the feature no longer exists since this was merged -  https://github.com/vercel/next.js/pull/19118

It certainly caught me out! 😬 https://github.com/vercel/next.js/issues/20438
2020-12-29 00:29:32 +00:00
Joe Bernard
d434f1dde1
Docs typo fix (#20498)
* Docs typo fix

* Update docs/basic-features/environment-variables.md

Co-authored-by: Lachlan Campbell <lachlanjc@hey.com>

Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: Lachlan Campbell <lachlanjc@hey.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-12-28 14:21:26 -05:00
Max Romanyuta
c8837dcbda
Upgrade all http links to https (#20402)
Upgraded all `http` links to `https` that support the `https` protocol.

Llinks
-----
- https://github.com/
- https://koajs.com
- https://ant.design
- https://www.carbondesignsystem.com/components/overview
- https://themes.carbondesignsystem.com
- https://knexjs.org
- https://jxnblk.com/rebass
- https://i.imgur.com/JCxtWSj.gif
- https://react.semantic-ui.com
- https://stomp.github.io
- https://videojs.com
2020-12-22 21:41:27 +00:00
Lee Robinson
9c917ab263
Add note to deployment docs about handling new versions. (#20373)
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-12-22 13:59:27 +01:00
Rob
c86757bcc7
changed ref from 'master' to 'main' branch (#20390)
Changed reference from 'master' to 'main' branch under DPS section in line with GitHub's recent switch from master to main branch as base repo branch names.
2020-12-22 12:36:50 +00:00
Vitor Barbosa
7e20231643
Fix source map config description (#20279)
This should fix  source map config description text.
2020-12-17 20:34:28 +00:00
Tim Neutkens
72fae8bed4
Move productionBrowserSourceMaps out of experimental (#20267)
Makes https://www.npmjs.com/package/@zeit/next-source-maps a built-in feature so that it can be deprecated.
2020-12-17 15:04:17 +00:00
Leo Toneff
25cb43a73b
Added flag to identify shallow router events (#19802)
This PR is an implementation of RFC #13276 (more specifically @banerjeesouvik's [suggestion](https://github.com/vercel/next.js/discussions/13276#discussioncomment-17874)) which solves #3322 by adding an extra parameter to the router events that'll allow you to see whether or not the route is shallow.

This is a recreation of PR #13243.
2020-12-17 09:14:50 +00:00
Tuan Nguyen
977b3ed769
Correct a typo (#20183) 2020-12-14 21:43:12 +00:00
Dmitry Belyaev
a442841517
Update Link documentation (#19980)
Mention onClick property for next/link wrapping custom components
2020-12-14 10:02:10 +00:00
Joi Glifberg
ac89474303
Add dynamic and import note. (#20145)
Add note about import required to be explicit and dynamic required to be top-level module.
2020-12-14 09:42:53 +00:00
Craig Johnson
114f4801df
Update introduction.md (#20129)
Grammar correction.
2020-12-14 09:55:52 +01:00
Bruno Antunes
8340e6d345
[Image Component] image sizes property becomes 100vw by default (#20067)
Currently if sizes is not defined, Next.js is setting sizes as:
```
(max-width: 640px) 640px, (max-width: 750px) 750px, (max-width: 828px) 828px, (max-width: 1080px) 1080px, (max-width: 1200px) 1200px, (max-width: 1920px) 1920px, (max-width: 2048px) 2048px, 3840px'
```

This pull request will make sizes be `100vw` by default, which will allow us to download "smaller" images than what's currently happening. 

In a demo app I have, the difference is between downloading 488KB vs 1.4MB (in images)
2020-12-10 21:29:37 +00:00
JJ Kasper
782537dd2d
Add NEXT_LOCALE cookie note to docs (#20045)
Closes: https://github.com/vercel/next.js/issues/20044
2020-12-09 22:45:05 +00:00
JJ Kasper
e6c1aa6483
Add locale: false custom route prefix note (#19765)
This makes sure to note how custom-routes need to be prefixed when `locale: false` is used for routes to be matched correctly. 

Closes: https://github.com/vercel/next.js/issues/19703
2020-12-04 13:32:50 +00:00
Michael McQuade
3924b00478
docs/Remove extra word (#19754)
Remove extra word "the"
2020-12-02 18:09:54 +00:00
Lee Robinson
8c2cb4640a
Clarify data fetching documentation on calling API routes. (#19748)
We've received some feedback that the current note about calling API routes inside gSP/gSSP is confusing. This updates the wording to make it clear you can still use `fetch` in your application, and also to not say you "import" an API route. You import the _logic_ inside the route.
2020-12-02 16:23:42 +00:00
Vyacheslav Matyukhin
7e387f0fce
Avoid misleading inline comments in .env example (#19708)
dotenv currently doesn't support inline comments (see https://github.com/motdotla/dotenv/issues/484), so it's misleading to use inline comments in documentation examples.
2020-12-01 17:34:05 +00:00
Tim Neutkens
ad8999356d Move note about next export and i18n 2020-11-30 11:15:32 +01:00
Wesley Tian
1231ddb001
Fix typo in image-optimization.md (#19670)
Either use `avoid` or `prevent` as verb, but not both.
2020-11-30 02:00:38 +00:00
Curt Siffert
f4bf8a4696
Update getInitialProps.md (#19506)
To clarify what I've noticed as a common source of confusion in discussions online. Fixes https://github.com/vercel/next.js/issues/19426 

If you wish to know whether the code is running as part of a client-side page transition, in either `getInitialProps` or `getServerSideProps`, you can check to see if `context.req.url` starts with `/_next/data`.
2020-11-25 11:23:04 +00:00
Luis Alvarez D
86a0c7b0f7
Remove mention of the Next.js site repo from docs (#19504)
Fixes https://github.com/vercel/next.js/issues/19503
2020-11-25 01:21:51 +00:00
Luis Alvarez D
0ed8152858
Update documentation links (#19502)
- Updated some links in docs that don't have the `.md` extension. Not required for our live docs but useful for the GitHub view.
- Updated links that go to https://nextjs.org/docs to a relative path, that way they'll work for versioned docs
- Updated the `Regex Path Matching` example to be consistent with the paragraph above and with the official example in /examples.
2020-11-25 00:00:06 +00:00
Balázs Orbán
532a5bcc75
Fix grammar in API routes: Introduction (#19385)
For an API route to work, you need to `export as default a function` (a.k.a **request handler**), which then receives the following parameters:
For an API route to work, you need to `export a function as default` (a.k.a **request handler**), which then receives the following parameters:


I might be wrong though (not a native English speaker), it just sounds strange to my ears.
2020-11-24 21:26:02 +00:00
Luis Alvarez D
af5b8ceb7a
Update next export docs to mention i18n caveat (#19491)
Fixes https://github.com/vercel/next.js/issues/19486
2020-11-24 19:23:39 +00:00
Shihabudheen US
fc9fa10618
Add note about disabling prefetching (#19299)
Added the line _Prefetch can be disabled by passing `prefetch={false}`._
2020-11-20 14:44:29 +00:00
JJ Kasper
13f8732f86
Add note to docs for i18n and next export (#19321)
This adds a note about current `i18n` support and `next export` since it is not currently supported as was mentioned in the [initial RFC](https://github.com/vercel/next.js/discussions/17078)

x-ref: https://github.com/vercel/next.js/issues/18318
2020-11-19 17:04:18 +00:00
Lee Robinson
d47d83d88d
Update incremental adoption documentation. (#19286)
Some slight tweaks to match the corresponding blog post.
2020-11-19 00:10:12 +00:00
Vitor Dino
c3293b730e
Fix docs about the return of getStaticProps on basic-features/pages (#19267) 2020-11-18 14:06:18 +01:00
Luis Alvarez D
b955268dbb
Update next/link docs to not include example without href (#19247)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-11-18 13:39:35 +01:00
Lee Robinson
6826ddf9d7
Add docs on incrementally adopting Next.js. (#19226)
Building off the "Migrating to Next.js" section started, this doc provides information on using `rewrites`, `redirects`, and micro-frontends to incrementally adopt Next.js in your codebase.
2020-11-17 12:51:12 +00:00
GH Lee
23111ca057
Update fast-refresh.md (#18047)
ref. https://github.com/vercel/next.js/pull/14519, https://github.com/vercel/next.js/pull/15062
Add limitation for Anonymous arrow functions.
2020-11-16 22:46:43 +00:00
Luis Alvarez D
43e7561240
Update multi zones example (#16281)
~Updated the `with-zones` example and docs to use `@vercel/next` instead of `@now/next` and also updated the readme instructions with better steps.~

~Related to https://github.com/vercel/next.js/issues/12317 - Looks like there may be an issue with the example but it continues to work as expected to me, moving away from `@now/next` may help.~

Fixes https://github.com/vercel/next.js/issues/12317
Closes https://github.com/vercel/next.js/issues/12317

Moved the example to use [Vercel Monorepos](https://vercel.com/blog/monorepos). Locally it switches to `next dev` instead of `vercel dev`.
2020-11-16 16:21:13 +00:00
Amr Saber
c8a29235b5
Update response-helpers.md (#19189)
Update the mentioned redirection status message.
2020-11-16 13:48:30 +01:00
JJ Kasper
1e61b69e31
Add locale: false for custom-routes + i18n (#19164)
This mirrors the `basePath: false` behavior for custom-routes with `locale: false` to allow users to configure the locales manually (`locale: false`) or have the locales be handled automatically for custom-routes. 

Fixes: https://github.com/vercel/next.js/issues/18927
Fixes: https://github.com/vercel/next.js/issues/18795
2020-11-14 03:35:42 +00:00
Steven
84716ae60d
Add next/image docs for omitted props (#19158)
This will make it clear which properties are not allowed
2020-11-14 00:07:47 +00:00
Steven
7aa8c2c7ec
Update docs to use <Image> instead of <img> (#19160)
This unifies the docs to always use `<Image>` instead of `<img>` so we can set readers up for success.
2020-11-13 23:43:05 +00:00
Steven
20ab35128c
Add missing sizes prop on image component (#19128)
- Fixes #19120
- Closes #18413 
- Related to #19041
2020-11-13 04:30:41 +00:00
Tuan Nguyen
c64bbfeacd
Propose some sentence changes (#19121) 2020-11-12 20:08:31 +00:00
JJ Kasper
6c282a3df4
Add note about changing basePath config (#19111) 2020-11-12 12:48:37 -05:00
Tim Neutkens
feb0cb497b
Add upgrading guide from Next.js 9 to 10 (#19101)
There are no breaking changes but we're seeing some reports of confusion because there's no section for 9 to 10, so this adds it.
2020-11-12 15:22:59 +00:00
Steven
917d594ca8
Print error during next export with default image loader (#19032)
Fixes #18356
2020-11-11 15:46:48 +00:00
Michael McQuade
9e59a6b57a
Add type keyword to API Routes examples (#18234)
The other examples are using the typescript `import type` style, which gets stripped during the build, so I added it to the API Routes example too.
2020-11-09 03:24:02 +00:00
Luis Alvarez D
38a24a9b91
Add docs for fallback: 'blocking' (#18568)
Notes:

- I use "blank page" to refer to that state where a new tab is waiting for the initial HTML. Lmk if there are better words to describe that.
- I did not add an usage example because it's the same thing of `fallback: true` and `fallback: false`, but with a config change. It's also explained below them and mentions the similarity with `fallback: true`

---

Fixes #18468
2020-11-09 02:38:04 +00:00
Luis Alvarez D
d87bc3de98
Update docs for notFound and redirect (#18870)
Note that the indentation of the code samples and notes is important so it uses the same indentation of the items in the list.

Fixes https://github.com/vercel/next.js/issues/18869
2020-11-06 03:15:08 +00:00
Steven
b684b110e4
Add props objectFit and objectPosition to Image component (#18849)
Fixes #18794
2020-11-05 19:42:55 +00:00
JJ Kasper
6fbe5b439d
Add note about domain locales (#18845) 2020-11-05 10:35:22 -06:00
Alex Vilchis
907888c70a
(docs) Add format to notFound for consistency (#18363)
The previous props are in bold, but `notFound` is not.
2020-11-05 16:09:31 +00:00
Willian Justen
afe475d3d4
Fix typo on api-reference/image (#18818) 2020-11-04 18:28:18 -05:00
Abdelrahman Rifai
1bb318c082
docs: fix a typo "concatenated" instead of "concatentated" (#18812) 2020-11-04 18:28:06 -05:00
JJ Kasper
cdaf837f7c
Update asPath to mention basePath/locale stripping (#18807)
Tweak `asPath` docs to mention `basePath` and `locale` will not be included in the value. 

Closes: https://github.com/vercel/next.js/issues/18782
2020-11-04 19:44:57 +00:00
Joris W
5e9d1aae3d
Update exportPathMap.md (#18483)
This page claims that `exportPathMap` is only used by `next export`. This is somewhat misleading, as the mapping is also detected and applied during `yarn develop`. I welcome any other suggestions to make this clearer than I did in this PR.
2020-11-04 18:53:31 +00:00
Steven
35f8f521a2
Update Image docs with links to examples (#18770)
This revises the docs to add headings and also links to layout examples.

Fixes #18554
2020-11-04 17:24:14 +00:00
Steven
d4a92d92ba
Update example for Image Component (#18762) 2020-11-03 15:40:53 -05:00
Lee Robinson
4620dcc759
Update Gatsby migration guide to include next/image. (#18741)
Updates https://nextjs.org/docs/migrating/from-gatsby to mention the new `next/image` component released in Next.js 10.
2020-11-03 14:44:12 +00:00
Steven
2b94b1eea6
Update default widths configuration to handle 2x/3x DPI (#18717)
- Update default `deviceSizes`
- Add default `imageSizes`
- Use `layout` value to determine which `srcset` to use

Fixes #18420 
Closes #18714
2020-11-03 02:12:46 +00:00
JJ Kasper
c8d26edf57
Allow passing statusCode for GS(S)P redirect (#18422)
This adds support for passing `statusCode` in a `redirect` from `getServerSideProps` or `getStaticProps` which matches the `redirect` shape allowed to be returned for `redirects` in `next.config.js`

Closes: https://github.com/vercel/next.js/issues/18350
2020-11-02 21:47:59 +00:00
JJ Kasper
d07b25a963
Add documentation for localeDetection: false (#18696)
Closes: https://github.com/vercel/next.js/issues/18694
2020-11-02 21:26:01 +00:00
JJ Kasper
ee6b7cab4e
Update redirect and notFound GS(S)P documentation (#18690)
This updates the documentation with the new `redirect` and `notFound` return values adding `redirect` to the `getStaticProps` section and adding a new section describing the return values allowed for `getServerSideProps`

Closes: https://github.com/vercel/next.js/pull/18626
Closes: https://github.com/vercel/next.js/issues/18691
2020-11-02 16:58:13 +00:00
Carmelo Scandaliato
197d46ddb9
Remove the static optimization indicator (#18629)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-11-02 09:27:36 +01:00
Joe Haddad
9569f5a31a
Deprecate Image unsized property and add layout="fill" (#18562)
This PR deprecates the `unsized` property from NextImage because the property did not accomplish the desired effect.

Users should rely on one of the new layouts instead:

- `<Image layout="fixed" />`
- `<Image layout="intrinsic" />`
- `<Image layout="responsive" />`
- `<Image layout="fill" />`

The `unsized` property will continue to work as-is in production but is deprecated and will throw in dev.

---

### TODO:
- [x] test `layout=fill` in typescript types
- [x] test `layout=fill` render behavior
- [x] test that `unsized` switches to `layout=fill`
- [x] test `next dev` erroring on `unsized`
- [ ] layout docs (tracked in issue #18554)
- [ ] both `layout=fill` and `layout=responsive` use all deviceWidths in the srcset

---

Fixes #18541 

Co-authored-by: Steven <steven@ceriously.com>
2020-10-31 18:34:06 -04:00
Steven
afa04d22db
Add layout prop to Image component (#18491)
This PR introduces a new `layout` property.

This allows 3 possible values (`fixed`, `intrinsic`, or `responsive`) which solve many use cases we have seen since 10.0.0 and will hopefully avoid usage of `unsized`.

Fixes #18351 

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-10-30 10:33:34 -04:00
yokinist
bb96fefa80
docs: Add description to i18n-routing (#18438)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-10-29 11:57:52 +01:00
Steven
44fe971e6b
Update image optimization docs to include blog details (#18401)
This PR documents some details that are mentioned in the blog post https://nextjs.org/blog/next-10
2020-10-28 17:29:42 +00:00
Steven
79314ef5d8
Update docs with details for cached images (#18399)
This PR explains the caching algorithm for the default loader.
2020-10-28 12:40:40 -04:00
Steven
3195de65d1
Fix docs default config values (#18319)
Missed one rename from #18294
2020-10-27 18:53:37 +00:00
Steven
ab0b0a8a4d
Update docs - add default config for images property (#18296)
- Explain how defaults work and what the default values are.
- Mention quality on the basic page
2020-10-27 14:07:33 +00:00
Steven
f773a1a44a
Rename iconSizes to imageSizes, remove size limitation (#18294)
This does two things:

- Rename `iconSizes` to `imageSizes`.
- Give priority to `imageSizes` regardless of `deviceSizes` as a means to opt-out of the srcset behavior.
2020-10-27 13:19:23 +00:00
Jesse Jafa
774286fcc3
update @now/next to @vercel/next (#18246) 2020-10-27 13:45:52 +01:00
Yuki Takemoto
a9984e4026
Update example link text (#18286)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-10-27 12:50:41 +01:00
Joe Haddad
080b91f986
Adjust default image quality to 75 (#18292) 2020-10-27 11:14:42 +00:00
JJ Kasper
379f4c6574
Expose configured default locale in GS(S)P methods (#18216) 2020-10-27 05:43:15 -04:00
Sam Robbins
046deab685
Add absolute import example (#17342)
Might be easier for some users to see a whole app set up with it
2020-10-27 07:36:42 +00:00
JJ Kasper
3c9da075ff
Add i18n routing docs to manifest (#18264)
Follow-up to https://github.com/vercel/next.js/pull/18067 this adds the manifest item for the new docs
2020-10-27 07:12:27 +00:00
Steven
3a169fbbf0
Separate config into deviceSizes and iconSizes (#18267)
This separates the `next.config.js` property `images.sizes` into to properties: `images.deviceSizes` and `images.iconSizes`.

The purpose is for images that are not intended to take up the majority of the viewport.


Related to #18122
2020-10-26 20:07:52 +00:00
Tim Neutkens
557a0001db
Update image-optimization.md 2020-10-26 18:17:26 +01:00
Tim Neutkens
c381a35247
Update image-optimization.md 2020-10-26 18:13:21 +01:00
Tim Neutkens
8db23295d3
Update image-optimization.md 2020-10-26 18:12:40 +01:00
Tim Neutkens
129fb85da4
Update image-optimization.md 2020-10-26 18:07:23 +01:00
Steven
ce38e4f6fe
FIx image optimization docs (#18254)
Add missing links in the documentation
2020-10-26 12:51:11 -04:00
Steven
3c6f421d99
Add docs for Image Optimization (#18107)
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2020-10-24 14:53:28 +02:00
JJ Kasper
d4397d8ab5
Add initial i18n documentation (#18067)
* Add initial i18n documentation

* Apply suggestions from code review

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>

* Apply suggestions from code review

Co-authored-by: Lee Robinson <me@leerob.io>

* Apply more suggestions

* rephrase a bit more

* Update doc

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2020-10-23 10:42:52 -05:00
Francisco Baio Dias
58edd0998c
Fix typo in headers docs example (#18012) 2020-10-19 11:38:55 +00:00
Luis Alvarez D
e05f3a9112
Capitalize Data Fetching title in docs (#18001)
Noticed that most of our mentions to Data Fetching are capitalized in both words, but the page itself wasn't. And it's not consistent with the titles in other sections
2020-10-19 01:31:40 +00:00
Greg Rickaby
5b1be2bb98
(docs) Fixes for "Migrating from Gatsby" doc (#17858)
Noticed there's an extra backslash in the example which causes an error. 

**EDIT:**

Also the promise needs to be resolved using `.toString()` before it can be returned as `content` in props.
2020-10-14 03:01:38 +00:00
José Antonio Chio
7f798215b5
Add use-npm CLI flag docs (#17803)
Related issue: https://github.com/vercel/next.js/issues/10647#issuecomment-623703149

Sometimes we have both Yarn and NPM installed and want to explicitly bootstrap an app with the CLI using NPM. Having this flag documented could help people understand the package manager behavior and select NPM if that's their preference.
2020-10-13 19:40:29 +00:00
GP
f1b3818dad
docs: Clarify use of getStaticProps / getServerSideProps with app / document (#17839)
Fixes https://github.com/vercel/next.js/issues/17828.

This change adds a caveat to both the "Custom `App`" and "Custom `Document`" pages about how both `getStaticProps` and `getServerSideProps` aren't supported.
2020-10-13 19:17:47 +00:00
Amir Ali
d73b34c3fd
Fix higherOrderComponent causing broken layout (#17812)
`higherOrderComponent(WrappedComponent)` causing the layout broken in mobile screen. 
* refer to screenshots below.


![image](https://user-images.githubusercontent.com/43801058/95730641-faaa6c80-0c97-11eb-9951-2a47b61cefad.png)
![image](https://user-images.githubusercontent.com/43801058/95730661-0138e400-0c98-11eb-9f02-b4d0676fd21b.png)

if we could make it `HOC(WrappedComponent)` it will not break the layout in mobile screen
![image](https://user-images.githubusercontent.com/43801058/95730673-04cc6b00-0c98-11eb-8782-2fa1f760f8fd.png)
2020-10-13 18:55:21 +00:00
SaintMalik
22f91bb355
Fix broken url caused in docs (#17789)
### Description

Easy navigation and easy reading for others.
2020-10-11 11:02:33 +00:00
Adebiyi Adedotun
ee97bc1b20
Fix grammatical typo in docs (#17779)
A URL is correct, not An URL
2020-10-11 06:41:40 +00:00
Jashn Maloo
7dec91175c
change anonymous functions to named in docs examples (#17510)
Fixes #17200
2020-10-05 21:16:47 +00:00
Lee Robinson
1659e4da61
Update migrating from Gatsby docs. (#17636)
Addresses remaining comments from https://github.com/vercel/next.js/pull/17491.
2020-10-05 20:20:26 +00:00
Lee Robinson
06a8b1ad67
Add docs on how to migrate from Gatsby. (#17491)
Addresses https://github.com/vercel/next.js/issues/17453.
2020-10-05 17:39:00 +00:00
Joris W
f8aeaa479e
Add missing introductory exportPathMap purpose description (#17444)
The page describing exportPathMap goes straight into an example without explaining what the config is for.
2020-10-03 14:50:37 +00:00
Yann Pringault
75a0ef9cc2
[docs] Fix typo Next.js -> TypeScript (#17561) 2020-10-02 10:27:38 -05:00
JJ Kasper
05fb9df06d
Add note about priority to rewrites docs (#17535)
This adds a note about public files and pages taking higher priority over rewrites causing them to not be able to be rewritten unless the files are renamed first since this has been asked a few times. 

x-ref: https://github.com/vercel/next.js/discussions/17513
x-ref: https://github.com/vercel/next.js/discussions/9081#discussioncomment-22077
x-ref: https://github.com/vercel/next.js/discussions/9081#discussioncomment-21995
2020-10-02 07:37:46 +00:00
Lee Robinson
fa244ef833
Mention favicon.ico in static file serving docs. (#17540) 2020-10-01 21:14:14 +00:00
Luis Alvarez D
816798569a
Mention required version for global CSS imports in node_modules (#17506)
Fixes https://github.com/vercel/next.js/issues/17505
2020-10-01 08:58:22 +00:00
Sam Robbins
c45497e1c3
Remove reference to now env example (#17341)
The example has been emptied as it is no longer the recommended way to do it so it shouldn't be linked to
2020-09-24 18:30:39 +00:00
Gergo Tolnai
8fdb93d76f
Docs(api-middlewares): use typings for serialize options from @types/cookie (#17285) 2020-09-22 18:52:29 +00:00
Luis Alvarez D
beeeba099b
Rename exportTrailingSlash to trailingSlash in docs (#17268) 2020-09-22 12:10:10 +02:00
GH Lee
92b20c8a1e
Update cdn-support-with-asset-prefix.md (#17237)
Modified paths to absolute paths.
- Deploying to Vercel
- Base path
2020-09-20 21:33:02 -05:00
Daniel Lauzon
571f8bedf7
Update trailingSlash parameter name (#17228)
Reflect the change in `trailingSlash` parameter name.

I found this because of the great warning on the build!
```
Warning: The "exportTrailingSlash" option has been renamed to "trailingSlash". Please update your next.config.js.
```
2020-09-19 19:13:26 +00:00
Dan Laugharn
5f16e063a6
Adds note about public directory (#17203)
This comes up a lot in discussions/as an issue, so added a small comment about uploading files to the public directory. I'm not sure if it is worth a deeper technical explanation as well.
2020-09-18 15:02:37 +00:00
Luis Alvarez D
4ba768e22c
Add missing comma in docs example (#17129)
Including prettier changes that were done automatically after the code sample became valid.
2020-09-16 01:04:58 +00:00
JJ Kasper
d3f4a4cb2a
Provide resolvedUrl to getServerSideProps (#17082)
This continues off of https://github.com/vercel/next.js/pull/17081 and provides this normalized `asPath` value in the context provided to `getServerSideProps` to provide the consistent value since the request URL can vary between direct visit and client transition and the alternative requires building the URL each time manually. 

Kept this change separate from https://github.com/vercel/next.js/pull/17081 since this is addressing a separate issue and allows discussion separately. 

Closes: https://github.com/vercel/next.js/issues/16407
2020-09-14 21:01:04 +00:00
Vincent Voyer
71c5ab629e
docs(babelrc): precise usage without configuring plugins (#16779) 2020-09-12 01:16:24 -04:00
Vahid Hallaji
d4a8d4fc88
fix gtag syntax in measuring docs (#16933) 2020-09-12 01:15:40 -04:00
Jonathan Svenheden
6659334930
Update build time env variable link in the runtime config section (#17017)
Since [the current link](https://nextjs.org/docs/api-reference/next.config.js/environment-variables) for the build-time environment variables docs recommends the approach outlined in [this section](https://nextjs.org/docs/basic-features/environment-variables), I think the link should point there instead.
2020-09-12 04:29:18 +00:00
Joe Haddad
6ecb740415
Improve Asset Prefix Docs (#16998)
Fixes #16444
2020-09-10 13:46:37 -04:00
Joe Haddad
fa9523c063
Document CSS Grid Better (#16996)
Fixes #10508
2020-09-10 13:46:14 -04:00
Joe Haddad
1ea6745106
Importing CSS from Third Party React Components (#16993) 2020-09-10 13:45:30 -04:00
Turcan Vladimir
b227691942
Fix align documentation with the code (#16843) 2020-09-08 12:29:42 -04:00
Luis Alvarez D
ea2df6c0c2
Update link docs to reflect changes on dynamic routing (#16634)
Closes https://github.com/vercel/next.js/issues/16633

- The docs and examples that use `as` have been updated to show how `href` can be used to get the same results
- Added new examples and provided more details on current examples for more details on how `href` can be used.

**Note:** With this change the usage of `as` becomes completely unrequired as I failed to find a good use case for it. Therefore documentation for `as` now includes: `Used for dynamic routes before Next.js 9.5.3`. But that should link to somewhere, either to a blog post or to the Upgrade Guide in our docs.
2020-09-07 16:35:30 +00:00
Luis Alvarez D
b5cf3e4c94
Update dynamic-import docs (#16803)
Goals of this PR:

- Explain `import()` first without mentioning `next/dynamic`, because `next/dynamic` in our API and **Dynamic Import** is a ES feature. This should avoid a common confusion in our users thinking that one can't be used without the other.
- Mention how `next/dynamic` can be used with **Dynamic Imports** to load react components.
- Updated example to include fuzzy search using a dynamic import.

Potential change: Leave the page to be about `import()` and move `next/dynamic` to the API reference (alongside `next/link`, `next/router`, etc.)

Closes https://github.com/vercel/next.js/pull/16299
Closes https://github.com/vercel/next.js/issues/15711
2020-09-05 23:45:30 +00:00
Yichi Zhang
9e4bb5a129
Add Fast Refresh Demo (#16576)
Closes #16538 

Basically reverts #16497 and some minor changes. Also adds a link in the docs.

This reverts commit ec281df70b.
2020-09-01 23:27:57 +00:00
Luis Alvarez D
f1c4cb8b3b
Update preview mode docs to include API Routes (#16705)
Fixes https://github.com/vercel/next.js/issues/16661
2020-08-31 03:02:24 +00:00
Balázs Orbán
d6188a8e33
Clarify sending to Google Analytics in reportWebVitals (#16664)
Clarifies #16662

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-08-29 22:31:57 -04:00
Sam Robbins
8217597848
Add activeClassName to Link examples (#16658)
Allows people to more easily find how to style active links if they are wanting to
2020-08-28 19:03:40 +00:00
Rich Paret
5bda90f87b
Include yarn instructions (#16565)
* Include yarn instructions

Yarn seems like it's encouraged elsewhere (such as in create-next-app docs), so adding this to clarify it's supported here.

* Added to a similar case

Co-authored-by: Luis Alvarez D <luis@vercel.com>
2020-08-27 21:27:34 -05:00
Christian Pena Valerio
fc5f26b556
Fix github docs links (#16540)
Take care of the other links that aren't working while browsing github. Related to: #16505
2020-08-25 04:31:48 +00:00
Ondřej Chrastina
a856097402
Add Kontent example (#16034)
Hello everyone!

I would like to add the example using [Kentico Kontent](https://kontent.ai) as a data source for your example.
I have tried to be consistent with the other examples and showcase the preview as well.

I have tried to keep up with [Contribution guidelines](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples).

Thank you.
2020-08-24 22:58:53 +00:00
Christian Pena Valerio
c9ad33bd59
Update fast-refresh.md to fix 404 link (#16505) 2020-08-24 09:58:13 -05:00
Luis Alvarez D
333a9ea8ab
Documentation updates (#16503)
Fixes https://github.com/vercel/next.js/issues/16502

Check the issue for more details.
2020-08-24 02:23:12 +00:00
sharils
120b41ec8a
Document req and res (#16432)
* Document req and res

* lint fix

Co-authored-by: Luis Alvarez <luis@vercel.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-08-22 16:29:01 -05:00
JJ Kasper
4d0d09ba9d
Add version note to path aliases docs (#16479)
* Add version note to path aliases docs

* Update docs/advanced-features/module-path-aliases.md

Co-authored-by: Luis Alvarez D <luis@vercel.com>
2020-08-22 16:28:47 -05:00
JJ Kasper
c2a42e4350
Update build CLI docs with new flag (#16419) 2020-08-21 15:12:27 +02:00
Louis Juliendo
24f056c9b3
Fix typo in fast-refresh.md (#16292)
Just correcting a simple typo `fash` to `fast`
2020-08-18 13:15:39 +00:00
Rounak Agarwal
512782ee29
Update docs for server-side code in GS(S)P props (#16198)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-08-18 01:14:26 -04:00
Tuan Nguyen
2cb05b539e
Correct a couple of small grammar errors. (#16221)
Just noticed a couple of tiny grammar errors.
2020-08-15 21:51:33 +00:00
JJ Kasper
ceeb6c3fce
Mention header overriding behavior (#16089)
Closes: https://github.com/vercel/next.js/issues/16088
2020-08-12 04:27:31 +00:00
Tim Neutkens
16345f631e
Add codemod documentation (#16067)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-08-11 15:12:00 +02:00
Tim Neutkens
b8662d5766
Fix link to create-next-app docs (#16069)
Fixes #16066
2020-08-11 12:08:43 +02:00
Caleb Fetzer
79bab9771c
DOCS: Typo fixes - data-fetching (#16004)
Few typos, missing spaces, some small cleanup on grammar.
2020-08-08 15:33:34 +00:00
Arsalan Khattak
ebd1434a84
Add PWA Example (#15433)
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
2020-08-06 13:14:35 -04:00
Eric Piacentini
e18f74fe2d
Update Fast Refresh doc (#15923)
Co-authored-by: Luis Alvarez D <luis@vercel.com>
Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-08-06 12:34:05 -04:00
Joe Haddad
c86466f4ee
Add variable expansion note (#15917)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-08-05 23:39:32 -04:00
Robin Tom
5218e76818
Example for Redirects (Custom routes) (#15411)
This PR adds example for #15073 
> - [ ] `redirects` For [docs/api-reference/next.config.js/redirects.md](https://github.com/vercel/next.js/blob/canary/docs/api-reference/next.config.js/redirects.md)
2020-08-05 22:20:49 +00:00
Sigurður Gunnar Njálsson
abf6e74e8d
Remove outdated docs on serverless builds and runtime configs (#15907)
Fixes https://github.com/vercel/next.js/issues/15906

This should solve https://github.com/vercel/next.js/issues/15906. It simply removes a block that states runtime configuration for serverless builds are not supported.
2020-08-05 16:11:01 +00:00
Rounak Agarwal
f419ec198b
Update next build docs to include the --profile argument (#15766)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-08-05 15:15:12 +02:00
Joe Haddad
e0d0c2ebb5
Explain Sass Extensions in CSS Docs (#15830)
Fixes #15737
2020-08-03 23:50:46 -04:00
Mehedi Hassan
e89bcf7e39
Add docs page for Create Next App (#15454)
Following up from #14830, this PR adds a new page to the docs for Create Next App. The content is identical to the README created as part of #14830. 

Also added a link on the main `getting-started` page to the new docs for Create Next App to help users find more info on Create Next App if needed. 

I'm unsure as to whether the content for the documentation needs to be different from the one I wrote for the README. Please let me know if that's the case, and I will be happy to tweak the structure.
2020-08-03 13:43:16 +00:00