Skip to content

Commit 76ade73

Browse files
docs: Move optimizing pages to guides (#78500)
1 parent dba20c3 commit 76ade73

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+102
-86
lines changed

docs/01-app/01-getting-started/02-project-structure.mdx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ Top-level folders are used to organize your application's code and static assets
3131

3232
Top-level files are used to configure your application, manage dependencies, run middleware, integrate monitoring tools, and define environment variables.
3333

34-
| | |
35-
| -------------------------------------------------------------------------------------- | --------------------------------------- |
36-
| **Next.js** | |
37-
| [`next.config.js`](/docs/app/api-reference/config/next-config-js) | Configuration file for Next.js |
38-
| [`package.json`](/docs/app/getting-started/installation#manual-installation) | Project dependencies and scripts |
39-
| [`instrumentation.ts`](/docs/app/building-your-application/optimizing/instrumentation) | OpenTelemetry and Instrumentation file |
40-
| [`middleware.ts`](/docs/app/building-your-application/routing/middleware) | Next.js request middleware |
41-
| [`.env`](/docs/app/guides/environment-variables) | Environment variables |
42-
| [`.env.local`](/docs/app/guides/environment-variables) | Local environment variables |
43-
| [`.env.production`](/docs/app/guides/environment-variables) | Production environment variables |
44-
| [`.env.development`](/docs/app/guides/environment-variables) | Development environment variables |
45-
| [`.eslintrc.json`](/docs/app/api-reference/config/eslint) | Configuration file for ESLint |
46-
| `.gitignore` | Git files and folders to ignore |
47-
| `next-env.d.ts` | TypeScript declaration file for Next.js |
48-
| `tsconfig.json` | Configuration file for TypeScript |
49-
| `jsconfig.json` | Configuration file for JavaScript |
34+
| | |
35+
| ---------------------------------------------------------------------------- | --------------------------------------- |
36+
| **Next.js** | |
37+
| [`next.config.js`](/docs/app/api-reference/config/next-config-js) | Configuration file for Next.js |
38+
| [`package.json`](/docs/app/getting-started/installation#manual-installation) | Project dependencies and scripts |
39+
| [`instrumentation.ts`](/docs/app/guides/instrumentation) | OpenTelemetry and Instrumentation file |
40+
| [`middleware.ts`](/docs/app/building-your-application/routing/middleware) | Next.js request middleware |
41+
| [`.env`](/docs/app/guides/environment-variables) | Environment variables |
42+
| [`.env.local`](/docs/app/guides/environment-variables) | Local environment variables |
43+
| [`.env.production`](/docs/app/guides/environment-variables) | Production environment variables |
44+
| [`.env.development`](/docs/app/guides/environment-variables) | Development environment variables |
45+
| [`.eslintrc.json`](/docs/app/api-reference/config/eslint) | Configuration file for ESLint |
46+
| `.gitignore` | Git files and folders to ignore |
47+
| `next-env.d.ts` | TypeScript declaration file for Next.js |
48+
| `tsconfig.json` | Configuration file for TypeScript |
49+
| `jsconfig.json` | Configuration file for JavaScript |
5050

5151
<AppOnly>
5252

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
---
2-
title: Analytics
2+
title: How to add analytics to your Next.js application
3+
nav_title: Analytics
34
description: Measure and track page performance using Next.js Speed Insights
45
---
56

67
{/* The content of this doc is shared between the app and pages router. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}
78

8-
Next.js has built-in support for measuring and reporting performance metrics. You can either use the `useReportWebVitals` hook to manage reporting yourself, or alternatively, Vercel provides a [managed service](https://vercel.com/analytics?utm_source=next-site&utm_medium=docs&utm_campaign=next-website) to automatically collect and visualize metrics for you.
9+
Next.js has built-in support for measuring and reporting performance metrics. You can either use the [`useReportWebVitals`](/docs/app/api-reference/functions/use-report-web-vitals) hook to manage reporting yourself, or alternatively, Vercel provides a [managed service](https://vercel.com/analytics?utm_source=next-site&utm_medium=docs&utm_campaign=next-website) to automatically collect and visualize metrics for you.
910

1011
## Client Instrumentation
1112

docs/01-app/02-guides/environment-variables.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ This allows you to use a singular Docker image that can be promoted through mult
227227

228228
**Good to know:**
229229

230-
- You can run code on server startup using the [`register` function](/docs/app/building-your-application/optimizing/instrumentation).
230+
- You can run code on server startup using the [`register` function](/docs/app/guides/instrumentation).
231231
- We do not recommend using the [`runtimeConfig`](/docs/pages/api-reference/config/next-config-js/runtime-configuration) option, as this does not work with the standalone output mode. Instead, we recommend [incrementally adopting](/docs/app/guides/migrating/app-router-migration) the App Router if you need this feature.
232232

233233
## Environment Variables on Vercel
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: Instrumentation
2+
title: How to set up instrumentation
3+
nav_title: Instrumentation
34
description: Learn how to use instrumentation to run code at server startup in your Next.js app
45
related:
56
title: Learn more about Instrumentation
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: Lazy Loading
2+
title: How to lazy load Client Components and libraries
3+
nav_title: Lazy Loading
34
description: Lazy load imported libraries and React Components to improve your application's loading performance.
45
---
56

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: Local Development
2+
title: How to optimize your local development environment
3+
nav_title: Development Environment
34
description: Learn how to optimize your local development environment with Next.js.
45
---
56

@@ -34,7 +35,7 @@ npm run dev --turbopack
3435

3536
### 3. Check your imports
3637

37-
The way you import code can greatly affect compilation and bundling time. Learn more about [optimizing package bundling](/docs/app/building-your-application/optimizing/package-bundling) and explore tools like [Dependency Cruiser](https://github.com/sverweij/dependency-cruiser) or [Madge](https://github.com/pahen/madge).
38+
The way you import code can greatly affect compilation and bundling time. Learn more about [optimizing package bundling](/docs/app/guides/package-bundling) and explore tools like [Dependency Cruiser](https://github.com/sverweij/dependency-cruiser) or [Madge](https://github.com/pahen/madge).
3839

3940
### Icon libraries
4041

@@ -122,7 +123,7 @@ Consider if you really need them for local development. You can optionally only
122123

123124
If your app is very large, it might need more memory.
124125

125-
[Learn more about optimizing memory usage](/docs/app/building-your-application/optimizing/memory-usage).
126+
[Learn more about optimizing memory usage](/docs/app/guides/memory-usage).
126127

127128
### 7. Server Components and data fetching
128129

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: Memory Usage
2+
title: How to optimize memory usage
3+
nav_title: Memory Usage
34
description: Optimize memory used by your application in development and production.
45
---
56

@@ -11,7 +12,7 @@ Let's explore some strategies and techniques to optimize memory and address comm
1112

1213
Applications with a large amount of dependencies will use more memory.
1314

14-
The [Bundle Analyzer](/docs/app/building-your-application/optimizing/package-bundling) can help you investigate large dependencies in your application that may be able to be removed to improve performance and memory usage.
15+
The [Bundle Analyzer](/docs/app/guides/package-bundling) can help you investigate large dependencies in your application that may be able to be removed to improve performance and memory usage.
1516

1617
## Try `experimental.webpackMemoryOptimizations`
1718

docs/01-app/02-guides/migrating/from-create-react-app.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Depending on your needs, Next.js allows you to choose your data fetching strateg
4343

4444
### Built-in Optimizations
4545

46-
[Images](/docs/app/building-your-application/optimizing/images), [fonts](/docs/app/building-your-application/optimizing/fonts), and [third-party scripts](/docs/app/building-your-application/optimizing/scripts) often have a large impact on an application’s performance. Next.js includes specialized components and APIs that automatically optimize them for you.
46+
[Images](/docs/app/building-your-application/optimizing/images), [fonts](/docs/app/building-your-application/optimizing/fonts), and [third-party scripts](/docs/app/guides/scripts) often have a large impact on an application’s performance. Next.js includes specialized components and APIs that automatically optimize them for you.
4747

4848
## Migration Steps
4949

@@ -575,7 +575,7 @@ If everything worked, you now have a functioning Next.js application running as
575575
- [React Server Components](/docs/app/building-your-application/rendering/server-components)
576576
- **Optimize images** with the [`<Image>` component](/docs/app/building-your-application/optimizing/images)
577577
- **Optimize fonts** with [`next/font`](/docs/app/building-your-application/optimizing/fonts)
578-
- **Optimize third-party scripts** with the [`<Script>` component](/docs/app/building-your-application/optimizing/scripts)
578+
- **Optimize third-party scripts** with the [`<Script>` component](/docs/app/guides/scripts)
579579
- **Enable ESLint** with Next.js recommended rules by running `npx next lint` and configuring it to match your project’s needs
580580

581581
> **Note**: Using a static export (`output: 'export'`) [does not currently support](https://github.com/vercel/next.js/issues/54393) the `useParams` hook or other server features. To use all Next.js features, remove `output: 'export'` from your `next.config.ts`.

docs/01-app/02-guides/migrating/from-vite.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Depending on your needs, Next.js allows you to choose your data fetching strateg
4343

4444
### Built-in Optimizations
4545

46-
[Images](/docs/app/building-your-application/optimizing/images), [fonts](/docs/app/building-your-application/optimizing/fonts), and [third-party scripts](/docs/app/building-your-application/optimizing/scripts) often have significant impact on an application's performance. Next.js comes with built-in components that automatically optimize those for you.
46+
[Images](/docs/app/building-your-application/optimizing/images), [fonts](/docs/app/building-your-application/optimizing/fonts), and [third-party scripts](/docs/app/guides/scripts) often have significant impact on an application's performance. Next.js comes with built-in components that automatically optimize those for you.
4747

4848
## Migration Steps
4949

@@ -598,5 +598,5 @@ do next:
598598
- [React Server Components](/docs/app/building-your-application/rendering/server-components)
599599
- [Optimize images with the `<Image>` component](/docs/app/building-your-application/optimizing/images)
600600
- [Optimize fonts with `next/font`](/docs/app/building-your-application/optimizing/fonts)
601-
- [Optimize third-party scripts with the `<Script>` component](/docs/app/building-your-application/optimizing/scripts)
601+
- [Optimize third-party scripts with the `<Script>` component](/docs/app/guides/scripts)
602602
- [Update your ESLint configuration to support Next.js rules](/docs/app/api-reference/config/eslint)
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: OpenTelemetry
2+
title: How to set up instrumentation with OpenTelemetry
3+
nav_title: OpenTelemetry
34
description: Learn how to instrument your Next.js app with OpenTelemetry.
45
---
56

@@ -16,7 +17,11 @@ Read [Official OpenTelemetry docs](https://opentelemetry.io/docs/) for more info
1617
This documentation uses terms like _Span_, _Trace_ or _Exporter_ throughout this doc, all of which can be found in [the OpenTelemetry Observability Primer](https://opentelemetry.io/docs/concepts/observability-primer/).
1718

1819
Next.js supports OpenTelemetry instrumentation out of the box, which means that we already instrumented Next.js itself.
19-
When you enable OpenTelemetry we will automatically wrap all your code like `getStaticProps` in _spans_ with helpful attributes.
20+
21+
<PagesOnly>
22+
When you enable OpenTelemetry we will automatically wrap all your code like
23+
`getStaticProps` in _spans_ with helpful attributes.
24+
</PagesOnly>
2025

2126
## Getting Started
2227

@@ -33,13 +38,13 @@ npm install @vercel/otel @opentelemetry/sdk-logs @opentelemetry/api-logs @opente
3338

3439
<AppOnly>
3540

36-
Next, create a custom [`instrumentation.ts`](/docs/app/building-your-application/optimizing/instrumentation) (or `.js`) file in the **root directory** of the project (or inside `src` folder if using one):
41+
Next, create a custom [`instrumentation.ts`](/docs/app/guides/instrumentation) (or `.js`) file in the **root directory** of the project (or inside `src` folder if using one):
3742

3843
</AppOnly>
3944

4045
<PagesOnly>
4146

42-
Next, create a custom [`instrumentation.ts`](/docs/pages/building-your-application/optimizing/instrumentation) (or `.js`) file in the **root directory** of the project (or inside `src` folder if using one):
47+
Next, create a custom [`instrumentation.ts`](/docs/pages/guides/instrumentation) (or `.js`) file in the **root directory** of the project (or inside `src` folder if using one):
4348

4449
</PagesOnly>
4550

0 commit comments

Comments
 (0)