diff --git a/docs/advanced-features/custom-error-page.md b/docs/advanced-features/custom-error-page.md index 1f7913253773304..e3f4b2ddf79de98 100644 --- a/docs/advanced-features/custom-error-page.md +++ b/docs/advanced-features/custom-error-page.md @@ -97,4 +97,4 @@ If you have a custom `Error` component be sure to import that one instead. `next ### Caveats -- `Error` currently does not support Next.js [Data Fetching methods](/docs/basic-features/data-fetching.md) like [`getStaticProps`](/docs/basic-features/data-fetching.md#getstaticprops-static-generation) or [`getServerSideProps`](/docs/basic-features/data-fetching.md#getserversideprops-server-side-rendering). +- `Error` does not currently support Next.js [Data Fetching methods](/docs/basic-features/data-fetching.md) like [`getStaticProps`](/docs/basic-features/data-fetching/get-static-props.md) or [`getServerSideProps`](/docs/basic-features/data-fetching/get-server-side-props.md). diff --git a/docs/api-reference/next.config.js/exportPathMap.md b/docs/api-reference/next.config.js/exportPathMap.md index a5e4420ffa112ba..a1ef9f65021f165 100644 --- a/docs/api-reference/next.config.js/exportPathMap.md +++ b/docs/api-reference/next.config.js/exportPathMap.md @@ -40,7 +40,7 @@ module.exports = { } ``` -Note: the `query` field in `exportPathMap` cannot be used with [automatically statically optimized pages](/docs/advanced-features/automatic-static-optimization) or [`getStaticProps` pages](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) as they are rendered to HTML files at build-time and additional query information cannot be provided during `next export`. +Note: the `query` field in `exportPathMap` cannot be used with [automatically statically optimized pages](/docs/advanced-features/automatic-static-optimization) or [`getStaticProps` pages](/docs/basic-features/data-fetching/get-static-props.md) as they are rendered to HTML files at build-time and additional query information cannot be provided during `next export`. The pages will then be exported as HTML files, for example, `/about` will become `/about.html`. diff --git a/docs/api-reference/next.config.js/headers.md b/docs/api-reference/next.config.js/headers.md index 8ca39d02580b37f..5905a0860dd94ad 100644 --- a/docs/api-reference/next.config.js/headers.md +++ b/docs/api-reference/next.config.js/headers.md @@ -376,7 +376,7 @@ module.exports = { ### Cache-Control -Cache-Control headers set in next.config.js will be overwritten in production to ensure that static assets can be cached effectively. If you need to revalidate the cache of a page that has been [statically generated](https://nextjs.org/docs/basic-features/pages#static-generation-recommended), you can do so by setting `revalidate` in the page's [`getStaticProps`](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) function. +Cache-Control headers set in next.config.js will be overwritten in production to ensure that static assets can be cached effectively. If you need to revalidate the cache of a page that has been [statically generated](https://nextjs.org/docs/basic-features/pages#static-generation-recommended), you can do so by setting `revalidate` in the page's [`getStaticProps`](/docs/basic-features/data-fetching/get-static-props.md) function. ## Related diff --git a/docs/manifest.json b/docs/manifest.json index bdb700f85474163..8c54700ef30546f 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -17,11 +17,9 @@ "title": "Data Fetching", "routes": [ { - "title": "Overview", - "path": "/docs/basic-features/data-fetching/index.md", + "path": "/docs/basic-features/data-fetching", "redirect": { - "destination": "/docs/basic-features/data-fetching/overview.md", - "permanent": true + "destination": "/docs/basic-features/data-fetching/overview" } }, { diff --git a/docs/routing/introduction.md b/docs/routing/introduction.md index 6d165c22d6259fa..c2b8c8ddc8cd6dd 100644 --- a/docs/routing/introduction.md +++ b/docs/routing/introduction.md @@ -74,7 +74,7 @@ The example above uses multiple links. Each one maps a path (`href`) to a known - `/about` → `pages/about.js` - `/blog/hello-world` → `pages/blog/[slug].js` -Any `` in the viewport (initially or through scroll) will be prefetched by default (including the corresponding data) for pages using [Static Generation](/docs/basic-features/data-fetching/get-static-props.md). The corresponding data for [server-rendered](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering) routes is _not_ prefetched. +Any `` in the viewport (initially or through scroll) will be prefetched by default (including the corresponding data) for pages using [Static Generation](/docs/basic-features/data-fetching/get-static-props.md). The corresponding data for [server-rendered](/docs/basic-features/data-fetching/get-server-side-props.md) routes is _not_ prefetched. ### Linking to dynamic paths diff --git a/errors/conflicting-ssg-paths.md b/errors/conflicting-ssg-paths.md index eb3e71a965bd91f..d7f03e9a8274dc4 100644 --- a/errors/conflicting-ssg-paths.md +++ b/errors/conflicting-ssg-paths.md @@ -65,4 +65,4 @@ export default function CatchAll() { ### Useful Links -- [`getStaticPaths` Documentation](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation) +- [`getStaticPaths` Documentation](https://nextjs.org/docs/basic-features/data-fetching/get-static-paths.md) diff --git a/errors/gsp-redirect-during-prerender.md b/errors/gsp-redirect-during-prerender.md index 964d7bf1db1ff9c..3246e0464df9145 100644 --- a/errors/gsp-redirect-during-prerender.md +++ b/errors/gsp-redirect-during-prerender.md @@ -10,4 +10,4 @@ Remove any paths that result in a redirect from being prerendered in `getStaticP ### Useful Links -- [Data Fetching Documentation](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) +- [Data Fetching Documentation](/docs/basic-features/data-fetching/get-static-props.md) diff --git a/errors/gssp-export.md b/errors/gssp-export.md index 62909cabf4e3986..3110e974f396523 100644 --- a/errors/gssp-export.md +++ b/errors/gssp-export.md @@ -33,6 +33,6 @@ The `getServerSideProps` lifecycle is not compatible with `next export`, so you' ### Useful Links -- [Automatic Static Optimization](https://nextjs.org/docs/advanced-features/automatic-static-optimization) -- [`getStaticProps` documentation](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) -- [`exportPathMap` documentation](https://nextjs.org/docs/api-reference/next.config.js/exportPathMap) +- [Automatic Static Optimization](/docs/advanced-features/automatic-static-optimization.md) +- [`getStaticProps` documentation](/docs/basic-features/data-fetching/get-static-props.md) +- [`exportPathMap` documentation](/docs/api-reference/next.config.js/exportPathMap.md) diff --git a/errors/gssp-mixed-not-found-redirect.md b/errors/gssp-mixed-not-found-redirect.md index 5f592ce610c6c6e..9765365a8394671 100644 --- a/errors/gssp-mixed-not-found-redirect.md +++ b/errors/gssp-mixed-not-found-redirect.md @@ -12,5 +12,5 @@ Make sure only `notFound` **or** `redirect` is being returned on your page's `ge ### Useful Links -- [`getStaticProps` Documentation](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) -- [`getServerSideProps` Documentation](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering) +- [`getStaticProps` Documentation](/docs/basic-features/data-fetching/get-static-props.md) +- [`getServerSideProps` Documentation](/docs/basic-features/data-fetching/get-server-side-props.md) diff --git a/errors/invalid-redirect-gssp.md b/errors/invalid-redirect-gssp.md index 5b966ffa0a2dfaa..7c17f2c416d4652 100644 --- a/errors/invalid-redirect-gssp.md +++ b/errors/invalid-redirect-gssp.md @@ -29,4 +29,4 @@ export const getStaticProps = ({ params }) => { ### Useful Links -- [Data Fetching Documentation](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) +- [Data Fetching Documentation](/docs/basic-features/data-fetching/get-static-props.md) diff --git a/errors/page-data-collection-timeout.md b/errors/page-data-collection-timeout.md index 431b61e4588df12..49d2d80fa9f688c 100644 --- a/errors/page-data-collection-timeout.md +++ b/errors/page-data-collection-timeout.md @@ -15,4 +15,4 @@ When restarted it will retry all uncompleted jobs, but if a job was unsuccessful ### Useful Links -- [`getStaticPaths`](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation) +- [`getStaticPaths`](/docs/basic-features/data-fetching/get-static-paths.md) diff --git a/errors/prerender-error.md b/errors/prerender-error.md index 8086abafc2da2f7..474926c9631ba0f 100644 --- a/errors/prerender-error.md +++ b/errors/prerender-error.md @@ -11,4 +11,4 @@ While prerendering a page an error occurred. This can occur for many reasons fro - Set default values for all dynamic pages' props (avoid `undefined`, use `null` instead so it can be serialized) - Check for any out of date modules that you might be relying on - Make sure your component handles `fallback` if it is enabled in `getStaticPaths`. [Fallback docs](https://nextjs.org/docs/api-reference/data-fetching/get-static-paths#fallback-false) -- Make sure you are not trying to export (`next export`) pages that have server-side rendering enabled [(getServerSideProps)](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering) +- Make sure you are not trying to export (`next export`) pages that have server-side rendering enabled [(getServerSideProps)](/docs/basic-features/data-fetching/get-server-side-props.md) diff --git a/errors/rewrite-auto-export-fallback.md b/errors/rewrite-auto-export-fallback.md index a16fa7125639d6f..af712a447757f5f 100644 --- a/errors/rewrite-auto-export-fallback.md +++ b/errors/rewrite-auto-export-fallback.md @@ -10,7 +10,7 @@ Rewriting to these pages are not yet supported since rewrites are not available For fallback SSG pages you can add the page to the list of [prerendered paths](https://nextjs.org/docs/basic-features/data-fetching#the-paths-key-required). -For static dynamic routes, you will currently need to either rewrite to non-dynamic route or opt the page out of the static optimization with [`getServerSideProps`](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering) +For static dynamic routes, you will currently need to either rewrite to non-dynamic route or opt the page out of the static optimization with [`getServerSideProps`](/docs/basic-features/data-fetching/get-server-side-props.md) ### Useful Links diff --git a/errors/static-page-generation-timeout.md b/errors/static-page-generation-timeout.md index 419731812b4ddc3..c8cc05e24f3418a 100644 --- a/errors/static-page-generation-timeout.md +++ b/errors/static-page-generation-timeout.md @@ -15,5 +15,5 @@ When restarted it will retry all uncompleted jobs, but if a job was unsuccessful ### Useful Links -- [`getStaticPaths`](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation) -- [`getStaticProps`](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) +- [`getStaticPaths`](https://nextjs.org/docs/basic-features/data-fetching/get-static-paths.md) +- [`getStaticProps`](https://nextjs.org/docs/basic-features/data-fetching/get-static-props.md) diff --git a/examples/api-routes-apollo-server/README.md b/examples/api-routes-apollo-server/README.md index 9b4209908adb216..5d1066048ddc365 100644 --- a/examples/api-routes-apollo-server/README.md +++ b/examples/api-routes-apollo-server/README.md @@ -1,6 +1,6 @@ # Consume local Apollo GraphQL schema to create Static Generation export -Next.js ships with two forms of pre-rendering: [Static Generation](https://nextjs.org/docs/basic-features/pages#static-generation-recommended) and [Server-side Rendering](https://nextjs.org/docs/basic-features/pages#server-side-rendering). This example shows how to perform Static Generation using a local [Apollo GraphQL](https://www.apollographql.com/docs/apollo-server/) schema within [getStaticProps](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) and [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation). The end result is a Next.js application that uses one Apollo GraphQL schema to generate static pages at build time and also serve a GraphQL [API Route](https://nextjs.org/docs/api-routes/introduction) at runtime. +Next.js ships with two forms of pre-rendering: [Static Generation](https://nextjs.org/docs/basic-features/pages#static-generation-recommended) and [Server-side Rendering](https://nextjs.org/docs/basic-features/pages#server-side-rendering). This example shows how to perform Static Generation using a local [Apollo GraphQL](https://www.apollographql.com/docs/apollo-server/) schema within [getStaticProps](https://nextjs.org/docs/basic-features/data-fetching/get-static-props) and [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching/get-static-paths.md). The end result is a Next.js application that uses one Apollo GraphQL schema to generate static pages at build time and also serve a GraphQL [API Route](https://nextjs.org/docs/api-routes/introduction) at runtime. ## Preview diff --git a/examples/with-apollo/pages/about.js b/examples/with-apollo/pages/about.js index 3bdc6a843afff6c..0390f8a8ec3ec0a 100644 --- a/examples/with-apollo/pages/about.js +++ b/examples/with-apollo/pages/about.js @@ -17,7 +17,7 @@ const AboutPage = () => (

In this simple example, we integrate Apollo seamlessly with{' '} Next by calling{' '} - + getStaticProps {' '} at our Page component. This approach lets us opt out of getInitialProps @@ -26,7 +26,7 @@ const AboutPage = () => (

On initial page load, while on the server and inside{' '} - + getStaticProps , we fetch the query used to get the list of posts. At the point in diff --git a/examples/with-iron-session/README.md b/examples/with-iron-session/README.md index 2e71410bc97fe03..23cabcd0957276c 100644 --- a/examples/with-iron-session/README.md +++ b/examples/with-iron-session/README.md @@ -10,7 +10,7 @@ It uses current best practices for authentication in the Next.js ecosystem and r **Features of the example:** -- [API Routes](https://nextjs.org/docs/api-routes/dynamic-api-routes) and [getServerSideProps](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering) examples. +- [API Routes](https://nextjs.org/docs/api-routes/dynamic-api-routes) and [getServerSideProps](https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props) examples. - The logged in status is synchronized between browser windows/tabs using **`useUser`** hook and the [`swr`](https://swr.vercel.app/). - The layout is based on the user's logged-in/out status. - The session data is signed and encrypted in a cookie (this is done automatically by `iron-session`). diff --git a/examples/with-iron-session/pages/profile-ssr.tsx b/examples/with-iron-session/pages/profile-ssr.tsx index 0d43fa6c286ae8c..3633ab3815c6271 100644 --- a/examples/with-iron-session/pages/profile-ssr.tsx +++ b/examples/with-iron-session/pages/profile-ssr.tsx @@ -18,7 +18,7 @@ export default function SsrProfile({ Server-side Rendering (SSR) {' '} and{' '} - + getServerSideProps diff --git a/examples/with-mux-video/README.md b/examples/with-mux-video/README.md index 0101c412907256c..d06882d9d4e7b22 100644 --- a/examples/with-mux-video/README.md +++ b/examples/with-mux-video/README.md @@ -32,7 +32,7 @@ This example uses: - [SWR](https://swr.vercel.app/) — dynamically changing the `refreshInterval` depending on if the client should be polling for updates or not - [`/pages/api`](pages/api) routes — a couple endpoints for making authenticated requests to the Mux API. -- Dynamic routes using [`getStaticPaths` and `fallback: true`](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), as well as dynamic API routes. +- Dynamic routes using [`getStaticPaths` and `fallback: true`](https://nextjs.org/docs/basic-features/data-fetching/get-static-paths), as well as dynamic API routes. ## Configuration