未验证 提交 279ae19c 编写于 作者: S stefanprobst 提交者: GitHub

docs: update links to docs site (#14305)

this updates some links to the docs site to their new location
上级 42c309ad
......@@ -18,7 +18,7 @@ You can read more about [Dynamic Routing here](https://nextjs.org/docs/routing/d
#### Check your Custom <App> (`pages/_app.js`)
If you previously copied the [Custom `<App>`](https://nextjs.org/docs#custom-app) example, you may be able to remove your `getInitialProps`.
If you previously copied the [Custom `<App>`](https://nextjs.org/docs/advanced-features/custom-app) example, you may be able to remove your `getInitialProps`.
Removing `getInitialProps` from `pages/_app.js` (when possible) is important to leverage new Next.js features!
......
......@@ -12,4 +12,4 @@ Use `next build` with platforms that don't require `next export` like https://ve
### Useful Links
- [Static HTML export](https://nextjs.org/docs#static-html-export)
- [Static HTML export](https://nextjs.org/docs/advanced-features/static-html-export)
......@@ -2,7 +2,7 @@
#### Why This Error Occurred
The filesystem does not allow writing to the specified directory. A common cause for this error is starting a [custom server](https://nextjs.org/docs#custom-server-and-routing) in development mode on a production server, for example, [Vercel](https://vercel.com) which [doesn't allow you to write to the filesystem after your app is built](https://vercel.com/docs/deployment-types/node#file-system-specifications).
The filesystem does not allow writing to the specified directory. A common cause for this error is starting a [custom server](https://nextjs.org/docs/advanced-features/custom-server) in development mode on a production server, for example, [Vercel](https://vercel.com) which [doesn't allow you to write to the filesystem after your app is built](https://vercel.com/docs/deployment-types/node#file-system-specifications).
#### Possible Ways to Fix It
......@@ -27,4 +27,4 @@ const app = next({ dev })
### Useful Links
- [Custom Server documentation + examples](https://nextjs.org/docs#custom-server-and-routing)
- [Custom Server documentation + examples](https://nextjs.org/docs/advanced-features/custom-server)
......@@ -12,4 +12,4 @@ Use a different `distDir` or export to a different folder.
### Useful Links
- [Static file serving docs](https://nextjs.org/docs#static-file-serving-eg-images)
- [Static file serving docs](https://nextjs.org/docs/basic-features/static-file-serving)
......@@ -28,4 +28,4 @@ pages/
### Useful Links
- [Static file serving docs](https://nextjs.org/docs#static-file-serving-eg-images)
- [Static file serving docs](https://nextjs.org/docs/basic-features/static-file-serving)
......@@ -23,4 +23,4 @@ module.exports = {
### Useful Links
- [exportPathMap](https://nextjs.org/docs#usage) documentation
- [exportPathMap](https://nextjs.org/docs/api-reference/next.config.js/exportPathMap) documentation
......@@ -36,4 +36,4 @@ export default YourEntryComponent
### Useful Links
- [Fetching data and component lifecycle](https://nextjs.org/docs#fetching-data-and-component-lifecycle)
- [Fetching data and component lifecycle](https://nextjs.org/docs/api-reference/data-fetching/getInitialProps)
......@@ -40,5 +40,5 @@ Look for any usage of the `next/link` component, `Router#push`, or `Router#repla
### Useful Links
- [Routing section in Documentation](https://nextjs.org/docs#routing)
- [Dynamic routing section in Documentation](https://nextjs.org/docs#dynamic-routing)
- [Routing section in Documentation](https://nextjs.org/docs/routing/introduction)
- [Dynamic routing section in Documentation](https://nextjs.org/docs/routing/dynamic-routes)
......@@ -16,4 +16,4 @@ Look for any usage of `next/link` or `next/router` that is being passed a non-in
### Useful Links
- [Routing section in Documentation](https://nextjs.org/docs#routing)
- [Routing section in Documentation](https://nextjs.org/docs/routing/introduction)
......@@ -22,5 +22,5 @@ export const config = { amp: true }
### Useful Links
- [Enabling AMP Support](https://nextjs.org/docs#enabling-amp-support)
- [API Middlewares](https://nextjs.org/docs#api-middlewares)
- [Enabling AMP Support](https://nextjs.org/docs/advanced-features/amp-support/introduction)
- [API Middlewares](https://nextjs.org/docs/api-routes/api-middlewares)
......@@ -6,6 +6,6 @@ You have a custom `pages/_document.js` that doesn't have the components required
#### Possible Ways to Fix It
Ensure that your `_document.js` is importing and rendering all of the [required components](https://nextjs.org/docs#custom-document).
Ensure that your `_document.js` is importing and rendering all of the [required components](https://nextjs.org/docs/advanced-features/custom-document).
In this case you are most likely not rendering the `<Head>` component imported from `next/document`.
......@@ -2,18 +2,18 @@
#### Why This Warning Occurred
You are using `getInitialProps` in your [Custom `<App>`](https://nextjs.org/docs#custom-app).
You are using `getInitialProps` in your [Custom `<App>`](https://nextjs.org/docs/advanced-features/custom-app).
This causes **all non-getStaticProps pages** to be executed on the server -- disabling [Automatic Static Optimization](https://nextjs.org/docs#automatic-static-optimization).
This causes **all non-getStaticProps pages** to be executed on the server -- disabling [Automatic Static Optimization](https://nextjs.org/docs/advanced-features/automatic-static-optimization).
#### Possible Ways to Fix It
Be sure you meant to use `getInitialProps` in `pages/_app`!
There are some valid use cases for this, but it is often better to handle `getInitialProps` on a _per-page_ basis.
Check for any [higher-order components](https://reactjs.org/docs/higher-order-components.html) that may have added `getInitialProps` to your [Custom `<App>`](https://nextjs.org/docs#custom-app).
Check for any [higher-order components](https://reactjs.org/docs/higher-order-components.html) that may have added `getInitialProps` to your [Custom `<App>`](https://nextjs.org/docs/advanced-features/custom-app).
If you previously copied the [Custom `<App>`](https://nextjs.org/docs#custom-app) example, you may be able to remove your `getInitialProps`.
If you previously copied the [Custom `<App>`](https://nextjs.org/docs/advanced-features/custom-app) example, you may be able to remove your `getInitialProps`.
The following `getInitialProps` does nothing and may be removed:
......
......@@ -2,16 +2,16 @@
#### Why This Warning Occurred
You are using `getInitialProps` in your [Custom `<App>`](https://nextjs.org/docs#custom-app).
You are using `getInitialProps` in your [Custom `<App>`](https://nextjs.org/docs/advanced-features/custom-app).
This causes **all pages** to be executed on the server -- disabling [Automatic Static Optimization](https://nextjs.org/docs#automatic-static-optimization).
This causes **all pages** to be executed on the server -- disabling [Automatic Static Optimization](https://nextjs.org/docs/advanced-features/automatic-static-optimization).
#### Possible Ways to Fix It
Be sure you meant to use `getInitialProps` in `pages/_app`!
There are some valid use cases for this, but it is often better to handle `getInitialProps` on a _per-page_ basis.
If you previously copied the [Custom `<App>`](https://nextjs.org/docs#custom-app) example, you may be able to remove your `getInitialProps`.
If you previously copied the [Custom `<App>`](https://nextjs.org/docs/advanced-features/custom-app) example, you may be able to remove your `getInitialProps`.
The following `getInitialProps` does nothing and may be removed:
......
......@@ -35,4 +35,4 @@ components/
### Useful Links
- [Static file serving docs](https://nextjs.org/docs#static-file-serving-eg-images)
- [Static file serving docs](https://nextjs.org/docs/basic-features/static-file-serving)
......@@ -25,7 +25,7 @@ const Home = (props) => (
<h3>Getting Started &rarr;</h3>
<p>Learn more about Next</p>
</a>
<a href="https://nextjs.org/docs#amp-support">
<a href="https://nextjs.org/docs/advanced-features/amp-support/introduction">
<h3>AMP Support in Next.js &rarr;</h3>
<p>Learn how to build AMP sites with Next.js</p>
</a>
......
# framer-motion example
Framer [`Motion`](https://github.com/framer/motion) is a production-ready animation library. By using a custom [`<App>`](https://nextjs.org/docs#custom-app) along with Motion's [`AnimatePresence`](https://www.framer.com/api/motion/animate-presence/) component, transitions between Next pages becomes simple and declarative.
Framer [`Motion`](https://github.com/framer/motion) is a production-ready animation library. By using a custom [`<App>`](https://nextjs.org/docs/advanced-features/custom-app) along with Motion's [`AnimatePresence`](https://www.framer.com/api/motion/animate-presence/) component, transitions between Next pages becomes simple and declarative.
When using Next's `<Link>` component, you will likely want to [disable the default scroll behavior](https://nextjs.org/docs#disabling-the-scroll-changes-to-top-on-page) for a more seamless navigation experience. Scrolling to the top of a page can be re-enabled by adding a `onExitComplete` callback on the `AnimatePresence` component.
When using Next's `<Link>` component, you will likely want to [disable the default scroll behavior](https://nextjs.org/docs/api-reference/next/link#disable-scrolling-to-the-top-of-the-page) for a more seamless navigation experience. Scrolling to the top of a page can be re-enabled by adding a `onExitComplete` callback on the `AnimatePresence` component.
## Deploy your own
......
# Example app with google analytics & amp
This example shows how to use [Next.js](https://github.com/vercel/next.js) along with [Google Analytics](https://developers.google.com/analytics/devguides/collection/gtagjs/) in conjunction with [AMP](https://nextjs.org/docs#amp-support). A custom [\_document](https://github.com/vercel/next.js/#custom-document) is used to inject [tracking snippet](https://developers.google.com/analytics/devguides/collection/gtagjs/) and track [pageviews](https://developers.google.com/analytics/devguides/collection/gtagjs/pages) and [event](https://developers.google.com/analytics/devguides/collection/gtagjs/events). There are two separate initializations of the Google Analytics tracking code; one for AMP and one for non-AMP pages.
This example shows how to use [Next.js](https://github.com/vercel/next.js) along with [Google Analytics](https://developers.google.com/analytics/devguides/collection/gtagjs/) in conjunction with [AMP](https://nextjs.org/docs/advanced-features/amp-support/introduction). A custom [\_document](https://nextjs.org/docs/advanced-features/custom-document) is used to inject [tracking snippet](https://developers.google.com/analytics/devguides/collection/gtagjs/) and track [pageviews](https://developers.google.com/analytics/devguides/collection/gtagjs/pages) and [event](https://developers.google.com/analytics/devguides/collection/gtagjs/events). There are two separate initializations of the Google Analytics tracking code; one for AMP and one for non-AMP pages.
## Deploy your own
......
......@@ -44,7 +44,7 @@ Deploy it to the cloud with [Vercel](https://vercel.com/import?filter=next.js&ut
## Notes
- By default, neither sourcemaps nor error tracking is enabled in development mode (see Configuration).
- When enabled in development mode, error handling [works differently than in production](https://nextjs.org/docs#custom-error-handling) as `_error.js` is never actually called.
- When enabled in development mode, error handling [works differently than in production](https://nextjs.org/docs/advanced-features/custom-error-page#customizing-the-error-page) as `_error.js` is never actually called.
- The build output will contain warning about unhandled Promise rejections. This is caused by the test pages, and is expected.
- The version of `@zeit/next-source-maps` (`0.0.4-canary.1`) is important and must be specified since it is not yet the default. Otherwise [source maps will not be generated for the server](https://github.com/zeit/next-plugins/issues/377).
- Both `@zeit/next-source-maps` and `@sentry/webpack-plugin` are added to dependencies (rather than `devDependencies`) because if used with SSR, these plugins are used during production for generating the source-maps and sending them to sentry.
......
......@@ -26,7 +26,7 @@ module.exports = withSourceMaps({
//
// Luckily, Next.js will call this webpack function twice, once for the
// server and once for the client. Read more:
// https://nextjs.org/docs#customizing-webpack-config
// https://nextjs.org/docs/api-reference/next.config.js/custom-webpack-config
//
// So ask Webpack to replace @sentry/node imports with @sentry/browser when
// building the browser's bundle
......
......@@ -2,7 +2,7 @@
This example features how you use a different styling solution than [styled-jsx](https://github.com/zeit/styled-jsx) that also supports universal styles. That means we can serve the required styles for the first render within the HTML and then load the rest in the client. In this case we are using [styled-components](https://github.com/styled-components/styled-components).
For this purpose we are extending the `<Document />` and injecting the server side rendered styles into the `<head>`, and also adding the `babel-plugin-styled-components` (which is required for server side rendering). Additionally we set up a global [theme](https://www.styled-components.com/docs/advanced#theming) for styled-components using NextJS custom [`<App>`](https://nextjs.org/docs#custom-app) component.
For this purpose we are extending the `<Document />` and injecting the server side rendered styles into the `<head>`, and also adding the `babel-plugin-styled-components` (which is required for server side rendering). Additionally we set up a global [theme](https://www.styled-components.com/docs/advanced#theming) for styled-components using NextJS custom [`<App>`](https://nextjs.org/docs/advanced-features/custom-app) component.
## Deploy your own
......
# Using multiple zones
With Next.js you can use multiple apps as a single app using it's [multi-zones feature](https://nextjs.org/docs#multi-zones). This is an example showing how to use it.
With Next.js you can use multiple apps as a single app using it's [multi-zones feature](https://nextjs.org/docs/advanced-features/multi-zones). This is an example showing how to use it.
- All pages should be unique across zones. For example, the `home` app should not have a `pages/blog/index.js` page.
- The `blog` app sets `assetPrefix` so that generated JS bundles are within the `/blog` subfolder.
......
......@@ -4,5 +4,5 @@ This package includes the global command for creating [Next.js](https://github.c
Please refer to its documentation:
- [Setup](https://nextjs.org/docs#setup) – How to create a new Next.js application.
- [Setup](https://nextjs.org/docs/getting-started#setup) – How to create a new Next.js application.
- [Documentation](https://nextjs.org/docs) – How to develop Next.js applications.
......@@ -716,7 +716,7 @@ export async function isPageStatic(
if (hasStaticProps && hasStaticPaths && !pageIsDynamic) {
throw new Error(
`getStaticPaths can only be used with dynamic pages, not '${page}'.` +
`\nLearn more: https://nextjs.org/docs#dynamic-routing`
`\nLearn more: https://nextjs.org/docs/routing/dynamic-routes`
)
}
......
......@@ -94,7 +94,7 @@ function createContainer(prefix) {
<button id="${prefix}close" title="Hide indicator for session">
<span>×</span>
</button>
<a href="https://nextjs.org/docs#automatic-static-optimization-indicator" target="_blank" rel="noreferrer">
<a href="https://nextjs.org/docs/api-reference/next.config.js/static-optimization-indicator" target="_blank" rel="noreferrer">
<div id="${prefix}icon-wrapper">
<svg width="15" height="20" viewBox="0 0 60 80" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M36 3L30.74 41H8L36 3Z" fill="black"/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册