Commit graph

385 commits

Author SHA1 Message Date
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
Sam Robbins
d0c57cf6b3
Add clarification of routing to a dynamic route (#15771)
While it is mentioned in the [link documentation](https://nextjs.org/docs/api-reference/next/link), I think it is useful to also explain in the dynamic route documentation that you need to include the as parameter when routing to a dynamic route/
2020-08-01 12:12:17 +00:00
Luis Alvarez D
01662f1c79
[Docs] Add upgrade notes for Next.js 9.5 (#15703)
Fixes https://github.com/vercel/next.js/issues/15719
2020-07-31 03:40:40 +00:00
JJ Kasper
766fef2271
Document regex support for custom routes (#15714)
This adds an example of using regex matching for custom routes

Fixes https://github.com/vercel/next.js/issues/15712
2020-07-30 21:15:29 +00:00
matamatanot
9d68a363b6
Docs smart-cdn link is dead. (#15707)
You have been redirected to the`/home` page.
I'm not sure if that's correct, but it's been fixed to move the link to the document.

https://vercel.com/smart-cdn
https://vercel.com/docs/v2/edge-network/overview
2020-07-30 19:14:27 +00:00
Luis Alvarez D
17d7f03f2b
[Docs] Use next dev for the getting started page (#15705) 2020-07-30 18:44:44 +00:00
Luis Alvarez D
925384c1cf
Added docs for Incremental Static Regeneration (#15663) 2020-07-29 22:35:25 -04:00
Luis Alvarez D
63ea2d8297
Add CSS Modules examples to docs (#15601)
Fixes https://github.com/vercel/next.js/issues/15595

- Updated the tailwindcss and tailwindcss-emotion examples to the latest version of tailwindcss
- Added a new `with-styled-jsx` example
- Updated the `basic-css` example to use CSS Modules instead of styled-jsx
- Added the examples to the documentation page for built-in css support
2020-07-29 14:43:48 +00:00
JJ Kasper
571e2a7cff
Add note about statusCode config for redirects (#15615)
This adds a note to our documentation about the `statusCode` config to match the note from the redirects documentation for [`vercel.json`](https://vercel.com/docs/configuration#project/redirects)
2020-07-29 09:23:23 +00:00
yokinist
1e8271ebe7
Update multi-zone example link from relative to absolute (#15618) 2020-07-29 09:12:52 +02:00
Luis Alvarez D
4dcf94e5c4
[Docs] Performance time is in milliseconds (#15544) 2020-07-28 10:19:09 +02:00
Luis Alvarez D
bf1af6880a
[Docs] Update links that should point to Vercel repos (#15547)
From feedback, we still have some links that go to zeit repos instead of vercel
2020-07-28 04:16:31 +00:00
Christopher Robert Van Wiemeersch
193ffe7616
fix typo in custom-webpack-config docs (#15533) 2020-07-27 19:24:29 +00:00
Tim Neutkens
a3eec3bf03
Update custom webpack config docs to mention existing features (#15517) 2020-07-27 11:46:17 +02:00
Tim Neutkens
f98e38c9b6
Add static tweet link (#15493) 2020-07-26 16:51:11 +02:00
Kaic Bastidas
d3955cdf51
TypeScript documentation for _document.tsx (#15386)
- Update the [Custom Document page](https://nextjs.org/docs/advanced-features/custom-document) to include an example using `DocumentContext`.
2020-07-26 01:36:36 +00:00
Robin Tom
1a34b237b6
Example for Rewrites (Custom routes) (#15403)
This PR adds example for #15073  
> - [ ] `rewrites` For [docs/api-reference/next.config.js/rewrites.md](https://github.com/vercel/next.js/blob/canary/docs/api-reference/next.config.js/rewrites.md)
2020-07-25 02:38:58 +00:00
Luis Alvarez D
eea25fc5dc
[Docs] Remove false caveat in custom document docs (#15355)
The statement is not true, we provide mocks for `req` and `res`.
2020-07-21 04:00:21 +00:00
Jan Potoms
7dd61b47a2
Fix basepath router events (#14848)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-07-20 16:03:49 -04:00
Joe Haddad
a11d99390a
Stabilize Trailing Slash API (#15331)
Closes #15330
2020-07-20 16:16:59 +00:00
Bruno Bernardino
3bfc25db9f
Clarify optional catch all vs catch all routes (#15290)
Makes the difference between optional catch all routes and catch all routes clearer.

Closes #15229
2020-07-18 20:13:47 +00:00
Jerry Gao
4a136476e7
Fix broken example link in docs for catch all routes (#15295)
Fixes a broken link on https://nextjs.org/docs/routing/dynamic-routes

This path was updated from `pages/docs/[...slug].js` to `pages/docs/[[...slug]].js`, so I've updated the link and moved that example down to the "Optional catch all routes" section.
2020-07-18 19:54:40 +00:00
Mario Beltrán Alarcón
56d62a52fd
docs: include test env in default env vars (#13708)
[Current Environment Variables doc](https://nextjs.org/docs/basic-features/environment-variables#default-environment-variables) mentions `development` and `production` env options but nothing about `test`. Test env is a 3rd valid option, and actually has some implications for `.env.local` from [what I can see in load env configs mechanism](https://github.com/vercel/next.js/blob/canary/packages/next/lib/load-env-config.ts#L68).

This PR aims to include corresponding `test` info for environment variables.
2020-07-17 01:36:12 +00:00
Rafael Almeida
59f147387b
Document API Middlewares with TypeScript (#14275)
My attempt to clear things up 😅

cc @Timer
2020-07-16 05:03:48 +00:00
Luis Alvarez D
55137629a7
Documentation improvements from feedback (#14544)
Co-authored-by: Shu Uesugi <shu@chibicode.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-07-14 00:15:55 -04:00
JJ Kasper
3a9cb2c5b3
Update docs for basePath custom-routes interop (#15140)
Follow-up to https://github.com/vercel/next.js/pull/15041 this updates the documentation for custom-routes to mention `basePath` handling with them
2020-07-14 01:26:54 +00:00
Tim Neutkens
9b711883cf
Update docs about type checking (#15103)
Related to #14997
2020-07-12 19:44:37 +00:00
Ashik Paul
98dbbcfd9a
Fixed some minor typos (#15080) 2020-07-11 16:57:15 +00:00
Oskar
8cd149c3ff
Update note about CDN in pages documentation (#14982)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-09 12:55:04 +02:00
Ben Botvinick
87ce591014
Change default response code to 307 from 302 in docs (#14947) 2020-07-07 21:36:16 -04:00
Ben Botvinick
d19c34353d
Add res.redirect response helper (#14705)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-07-07 01:06:16 -04:00
Tim Neutkens
fdc4c1773b
Add custom routes docs (rewrites, redirects, headers) (#14887)
Fixes #14452
2020-07-06 14:01:42 +00:00
Tim Neutkens
6fe1260b5f
Add basePath documentation (#14882)
Fixes #14453
2020-07-06 12:35:51 +00:00
Darsh Patel
e84537f88e
add NextWebVitalsMetric type for reportWebVitals (#14675)
Fixes: #13512
Defined and exported type for `metric`  used in [reportWebVitals](https://nextjs.org/docs/advanced-features/measuring-performance)

```
export function reportWebVitals(metric) {
  if (metric.label === 'custom') {
    console.log(metric) // The metric object ({ id, name, startTime, value, label }) is logged to the console
  }
}
```

One can now do 
```
import { NextWebVitalsMetric } from 'next/app'
export function reportWebVitals(metric: NextWebVitalsMetric ) {
  if (metric.label === 'custom') {
    console.log(metric) // The metric object ({ id, name, startTime, value, label }) is logged to the console
  }
}
```
2020-07-03 03:36:13 +00:00
Joe Haddad
1d0e7a8a9a
Enable Optional Catch-All by Default (#14687)
Closes #14682
2020-06-29 18:50:32 +00:00
Luis Alvarez D
a04fdc8475
Add Environment Variables Example (#14575)
Closes https://github.com/vercel/next.js/issues/14570
Closes https://github.com/vercel/next.js/issues/14576

- The example features everything on the page in our docs while still being quite simple
- Added a link to it in the documentation
- Deprecated the with-now-env example
2020-06-28 11:57:33 +00:00
Luis Alvarez D
0f60377967
Updated exportPathMap docs (#14630)
Closes https://github.com/vercel/next.js/issues/14596
2020-06-27 17:33:49 +00:00
James Bowes
166834e578
Update the passHref link (#14584)
Keeping up with section headers in markdown is fun :)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-06-26 11:08:48 -05:00
Luis Alvarez D
c6dc34e4d7
[Docs] Focus on useRouter (#14515)
[ch4109]

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

Our current docs for `next/router` use examples from both `useRouter` and `import Router from 'next/router'`, with this PR I'm unifying the API into `useRouter` (`withRouter` is still going to be mentioned multiple times as it is the HOC alternative) and no longer mentioning that you can import a global `Router` object from `next/router`, not sure if I should mention it at least once but that didn't seem to be required.

I also did some structural changes to the docs for `next/router`, now every method starts with a description, then the implementation and explanation of the parameters of the method, and then the usage example, because every method uses the same `Usage` title the hash for them would be something like `#usage`, `#usage-1`, `#usage-2`, e.t.c, so I'm not very happy with this but it looks good.

Feedback wanted 🙏
2020-06-25 23:35:28 +00:00
Jan Potoms
2142b76e6b
Normalize trailing slashes (#13333)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2020-06-23 13:38:49 +02:00
stefanprobst
279ae19c7e
docs: update links to docs site (#14305)
this updates some links to the docs site to their new location
2020-06-18 09:54:07 +00:00
Balázs Orbán
e87b739f33
fix typo in fast refresh documentation (#14296) 2020-06-18 01:11:07 +00:00
Joe Haddad
0426694ce0
Add Fast Refresh Documentation (#14273)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-06-17 14:57:57 -04:00
Bowen
da65f5e409
Update preview-mode.md (#14210)
It is an English grammar fix for the sentence, so that the user can better understand the documentation.
2020-06-17 04:24:35 +00:00
Jesse
d3704a66f8
added graphcms (#14026)
* added graphcms

* Updated readme and environment variables

* Removed gitignore

* Updated tailwind config

* Some fixes in pages

* Updated api endpoints

* lint fix

* Updated readme

* Updated og image

* Updated cms examples to include this one

* Added example to docs

* Added preview demo link

* Updated step

Co-authored-by: Luis Alvarez <luis@vercel.com>
2020-06-15 12:03:34 -05:00
Luis Alvarez D
0b4c32c2aa
[Docs] Update custom server docs (#14147)
[ch3235]
2020-06-13 08:47:13 +00:00
Shu Uesugi
30f30af320
Storyblok CMS Example (#13993)
[ch2842]

- Demo: https://next-blog-storyblok.now.sh/
- Preview Mode: https://next-blog-storyblok.now.sh/api/preview?secret=5nnybHTKlbzkOa6r&slug=draft-post-test
2020-06-10 22:23:28 +00:00
Jason Merino
0defd53564
Small grammar fix. (#14043) 2020-06-10 21:42:17 +00:00
Shu Uesugi
dea4c2cbf4
ButterCMS Example (#13908)
[ch2580]

**Demo:** https://next-blog-buttercms.now.sh/
**Preview Mode:** https://next-blog-buttercms.now.sh/api/preview?secret=CdEAKMRT4tAwzqiD&slug=draft-post-test
2020-06-10 17:13:10 +00:00
Rafael Almeida
a89afc2ec6
Add FAQ section to Built-in CSS Support (#13846)
I added a FAQ section to answer questions I see frequently. Motivation: https://github.com/vercel/next.js/discussions/13625#discussioncomment-23186
2020-06-06 22:40:04 +00:00
Rafael Almeida
813b1e62c5
Add App.getInitialProps example to the TypeScript page (#13785)
I added the commented code with the `AppContext` type to match the example from the [Custom App](https://nextjs.org/docs/advanced-features/custom-app) page. But since this is the TS page I think we could remove these comments and use a clean example, what do you think? 🤔
2020-06-05 18:03:31 +00:00
Shu Uesugi
4e6c326a56
Docs: Fix links to Agility CMS Examples (#13794)
 `cms-agility-cms`
 `cms-agilitycms`

See: https://github.com/vercel/next.js/tree/canary/examples/cms-agilitycms
2020-06-05 09:14:43 +00:00
Jan Potoms
1c8f1b50e3
Add a note about optional catch-all and rootmost route (#13791)
Fixes https://github.com/vercel/next.js/issues/13467
2020-06-05 06:19:01 +00:00
Jazib Sawar
6ce7a0378e
CMS Cosmic Example (#13499)
* Add Cosmic CMS Example

* with native .env support, this file isn't needed anymore

* FIX use path alias

* Add cosmicjs package

* Fix alias import in pages/api/preview

* Added: react-imgix & lazysizes package

* Load lazysizes in layout

* Used imgix image with lazyloading

* Added avatar imgix optimizations

* EDITED: steps to install content, preview

* EDITED: demo link

* EDITED: Install step

* EDITED: preview link steps

* Edited: demo link

* FIXED: object_slug

* Screenshots

* Fixed object_slug link

* Update README.md

* Fix: formatting issue

* Updated readme and renamed .env to env.local

* Sanity checks

* Handle fallback data when expected

* Added link to the example in other examples

* Updated demo deployment

* Added example to docs

* minor lint fix

* Remove manual download step

* use vercel.json

Co-authored-by: Tony Spiro <tspiro@tonyspiro.com>
Co-authored-by: Luis Alvarez <luis@vercel.com>
2020-06-04 15:18:11 -05:00
Joe Haddad
7d9b331775
docs: adjust custom polyfill suggestion (#13766)
The current [with-polyfills](https://github.com/vercel/next.js/blob/canary/examples/with-polyfills/) example is not the suggested way to add polyfills and is known to cause issues with bundling.

The proper way to load polyfills is to include them as the first line in `pages/_app.js`, which I've updated the docs to say.
2020-06-04 16:49:37 +00:00
Timothy
d1c16124b5
Update instances of Now to Vercel where applicable (#13760)
This pull request renames various instances of `now` to `vercel` etc. in order to match content that's being updated on the Vercel platform.
2020-06-04 14:57:17 +00:00
Vincent Voyer
33d44238a9
docs(env variables): small wording change (can => have to) (#13757)
When reading
"In order to expose a variable to the browser you can prefix the variable with NEXT_PUBLIC_. For example:"

I thought that I could maybe use something else than NEXT_PUBLIC_. I guess "have to" or similar would be better here, let me know
2020-06-04 13:22:12 +00:00
Shu Uesugi
c02d86ec52
Docs: Add supported browsers and features (#13741)
[ch1981]

Add the “Supported Browsers and Features” page. The content is taken mostly from the blog posts: [9.4](https://nextjs.org/blog/next-9-4), [9.3](https://nextjs.org/blog/next-9-3), and [9.1.7](https://nextjs.org/blog/next-9-1-7).

- This page is added under “Basic Features” on the sidebar.
- It still links to `with-polyfills` example, but [this example was updated recently](04fbe0b756). I simplified the README.
- Removed the FAQ section on supported browsers.
- On ["Customizing Babel Config"](https://nextjs.org/docs/advanced-features/customizing-babel-config), remove the list of presets which were outdated and instead link to [the preset file](https://github.com/vercel/next.js/blob/canary/packages/next/build/babel/preset.ts) so it’s always up to date.
2020-06-04 10:15:34 +00:00
James Mosier
bb6ae2648d
Added React Strict Mode documentation (#13723)
Added new documentation for React Strict mode under the `next.config.js` doc level.

Closes #13713
2020-06-03 17:22:58 +00:00
Joe Haddad
cfa00c9fcd
chore(docs): use proper Jamstack casing (#13697)
`JAMstack` is now `Jamstack`.
2020-06-03 03:02:41 +00:00
Jefferson Bledsoe
9ff29f710d
Docs: Add postcss-preset-env to the warning when customising the PostCSS configuration (#13695)
The [docs for customising the PostCSS config](https://nextjs.org/docs/advanced-features/customizing-postcss-config) warn the user they will need to manually install any dependencies that Next.JS will implicitly use if the config is not overridden. `postcss-preset-env` is missing from the install command.
2020-06-02 23:29:34 +00:00
Luis Alvarez D
ef22a8b7c5
[Examples] Add missing cms links (#13683)
This was a change that I forgot to push into the Agility CMS example PR, adding it now.
2020-06-02 17:36:12 +00:00
Shu Uesugi
d60fada097
CMS Strapi Example (#12701)
* Strapi Example

* Fix og image URL

* Remove next.config.js

* Apply updates

* Remove API_URL

* Bugfixes

* Finish Strapi README

* Deploy Strapi

* Add strapi examples

* now →  vercel [ch1796]

* Use npx

* Minor readme update

* Prettier fix

Co-authored-by: Luis Alvarez <luis@vercel.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-06-01 18:49:43 -05:00
Joe Haddad
f49309a92e
docs([[...rest]]): add experimental banner (#13641)
This feature is still experimental.
2020-06-01 22:51:57 +00:00
Luis Alvarez D
ad24a0c855
[Examples] Add WordPress Blog (#13194)
* Added most of the stuff

* Updated pages

* Removed unrequired deps

* API fixes

* Fixes fixes and updated readme

* Updated og image

* Added demo and links to example

* Updated packages

* update name. bump dependencies

* Renamed .env.example to .env.local.example

* Added node_modules to .gitignore

* use recommended config

* enable absolute import/alias support

* remove jsconfig.json

* allow HTML entities in post titles

* add underline to content links

* add basic ul & ol styles

* add code block styles

* add basic text alignment

* add basic image alignment styles

* adjust pre font-size and figcaption

* indent ul,ol lists to line up with grid

* add basic button styles

* add basic file styles

* add basic blockquote style

* add basic audio styles

* add h4 and enhance blockquote styles

* add basic cover block styles

* add basic verse styles

* add basic two-column block styles

* add tags

* add categories

* Only ignore .vercel

The rest is injected by create-next-app

* now → vercel

* npm init → npx

* Wordsmith

* Wordsmith

* Wordsmith

* Wordsmith

* Improve issue link

* Wordsmith

Co-authored-by: Greg Rickaby <greg@gregrickaby.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
Co-authored-by: Shu Uesugi <shu@chibicode.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-06-01 17:17:20 -05:00
Luis Alvarez D
ee87e5d811
Update links in environment variables documentation (#13621)
- The first links were updated to match the new titles
- Removed the `# .env.local` comment as it's redundant
- Added links to the sections related to data fetching
2020-05-31 23:24:14 +00:00
Tim Neutkens
c384ca3710
Update environment variables documentation (#13618)
Based on feedback from @mcsdevv's team. Solves many of the issues users run into with the current docs.
2020-05-31 21:43:49 +00:00
Pavel Korotenko
ff2a03f30a
Update AMP validation docs (#13525)
Updates docs for AMP validation with usage examples for custom validators added in #9191 and `skipValidation` mode added in #10705
2020-05-29 18:05:51 +00:00
Joe Haddad
f0ff77ed88
Add note about GS(S)P imports (#13475)
As reported here:
https://twitter.com/vvoyer/status/1246913957899763712?s=21
2020-05-28 03:22:15 +00:00
Joe Haddad
b7e17e09e5
Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
Manu Schiller
9f1b4f5694
Add type inference for getStaticProps and getServerSideProps (#11842)
This adds `InferredStaticProps` and `InferredServerSideProps` to the typings.

- [x] add types for type inference 
- [x] add explanation to docs
- [ ] tests - are there any?

![inferred-props](https://user-images.githubusercontent.com/56154253/79068041-24bcab00-7cc4-11ea-8397-ed1b95fbeca7.gif)

### What does it do:

As an alternative to declaring your Types manually with:
```typescript
type Props = {
  posts: Post[]
}

export const getStaticProps: GetStaticProps<Props> = () => ({
  posts: await fetchMyPosts(),
})

export const MyComponent(props: Props) =>(
 // ...
);
```

we can now also infer the prop types with
```typescript
export const getStaticProps = () => ({
  // given fetchMyPosts() returns type Post[]
  posts: await fetchMyPosts(),
})

export const MyComponent(props: InferredStaticProps<typeof getStaticProps>) =>(
 // props.posts will be of type Post[]
);

```

### help / review wanted
- [ ] I am no typescript expert. Although the solution works as intended for me, someone with more knowledge could probably improve the types. Any edge cases I missed?
- [ ] are there any tests I should modify/ add?
2020-05-27 19:02:22 +00:00
Jacob D. Castro
983d1da844
[Docs]: minor typo in jsx file extension (#13451)
There was no period before `jsx` in the list of file types for pages. I added the period for consistency.
2020-05-27 17:02:51 +00:00
s
dcf446d83d
Update Static HTML Export documentation (#11814)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-05-27 00:58:12 -04:00
Joe Haddad
7bd52b8dee
docs(static-html-export): note getServerSideProps (#13401)
x-ref: #12313
2020-05-26 17:16:04 +00:00
Shu Uesugi
de2363bd91
Update debugging docs (#13270)
* Update debugging docs

* typo

* Update docs/debugging.md

Co-authored-by: Luis Alvarez D. <luis@vercel.com>

* Update docs/debugging.md

Co-authored-by: Luis Alvarez D. <luis@vercel.com>

* Clarify

* Move to advanced features

Co-authored-by: Luis Alvarez D. <luis@vercel.com>
2020-05-23 15:58:33 -05:00
Vincent Voyer
aa51f2fcef
docs(debugging): explain how to debug in Chrome DevTools/VS Code (#10807)
This new documentation page explains how to debug your backend and frontend code in Chrome DevTools/VS Code. This works perfectly with full source map support for both Node.js and React code.

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-05-23 14:47:28 +02:00
Ian Sutherland
1a53f4500a
Update custom server docs (#13172) 2020-05-22 19:19:36 +02:00
Joe Haddad
1577ae5ce0
Fix dotenv file loading order (#13161)
This matches the `dotenv` spec:
https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use

---

Closes #13015
2020-05-22 17:13:16 +00:00
Luis Alvarez D
fca88d1cfe
Updated docs (#13205)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-05-22 10:36:45 +02:00
Luis Alvarez D
195e3e0ac3
[Docs] Replace hot reloading with fast refresh (#13207)
- Mention React Fast Refresh instead of hot reloading in docs
- Added a mention of our deployment docs in the main documentation page
- replaced `npm init` with `npx`
2020-05-22 02:40:06 +00:00
Zach Waterfield
25021473a5
Update the Automatic Static Optimization docs to explicitly state that Next.js will trigger an update. (#13096) 2020-05-19 18:09:57 +02:00
Tim Neutkens
dde5d3bdfe
Update prefetching explanation to correctly reflect data prefetching (#13088) 2020-05-19 07:03:42 -04:00
Joe Haddad
86160a5190
Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
Stig Kleppe-Jørgensen
97a61a18b2
x-powered-by is added to response, not request (#13037) 2020-05-18 12:58:29 -04:00
Jan Potoms
f8125c9ed7
[Experimental] Implement optional catch all routes (#12887) 2020-05-18 09:47:13 -04:00
Luis Alvarez D
c239c74629
Use a top level heading (#12960) 2020-05-16 15:04:18 +02:00
Tim Neutkens
313b552026
Enable .env support by default (#12911)
* Enable .env support by default

Given we've had tons of reports from various people that expected .env support to work even though they had dotenv installed already I think it's fine to enable it as a default:

Fixes #12728

* Remove old test

* Fix duplicate env loading

* Update docs

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-05-15 14:02:16 -05:00
Joe Haddad
9c79955047
Strip out dead code for ignoreDevErrors (#12941) 2020-05-15 13:30:01 -04:00
Nicholas Chiang
c21278999c
Update module-path-aliases.md (#12900) 2020-05-15 11:54:27 +02:00
Brian Gershon
5da1dcf669
Warn users about migrating to 9.4 from dotenv (#12859) 2020-05-14 12:09:33 -04:00
Rafael Almeida
634e621a6e
Fix typo in Environment Variables doc page (#12770) 2020-05-12 13:50:04 +02:00
Jamie Kyle
c88bc17830
Use an if statement instead of expression statement (#12747) 2020-05-11 23:51:26 -04:00
0xflotus
2a62e51a10
(docs): fixed typo error (#12746) 2020-05-11 17:08:31 -04:00
Sergio Xalambrí
e91c0fccbb
Add missing parenthesis in Sending results to analytics example (#12733) 2020-05-11 15:47:56 -04:00
Houssein Djirdeh
ec38b0f0bd
Minor update to "Measuring performance" docs (#12741) 2020-05-11 15:39:21 -04:00
Sébastien Vanvelthem
653098d397
Use @/ to show module alias instead of @ prefixed (#12600)
* docs: controversial '@' prefix aliases should not be used

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

Co-authored-by: Joe Haddad <timer150@gmail.com>

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

Co-authored-by: Joe Haddad <timer150@gmail.com>

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-05-11 13:52:59 +02:00
Luis Alvarez D
0b36211a1f
[Docs] Environment Variables (#12696) 2020-05-11 02:18:34 -04:00
Tim Neutkens
467b2c7ebc
Enable sassOptions support in next.config.js (#12685) 2020-05-10 22:11:48 -04:00