mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
docs: tweaks/fixes to papercuts (#87445)
This commit is contained in:
@@ -52,7 +52,6 @@ export function proxy(request: NextRequest) {
|
||||
// Alternatively, you can use a default export:
|
||||
// export default function proxy(request: NextRequest) { ... }
|
||||
|
||||
// See "Matching Paths" below to learn more
|
||||
export const config = {
|
||||
matcher: '/about/:path*',
|
||||
}
|
||||
@@ -69,10 +68,11 @@ export function proxy(request) {
|
||||
// Alternatively, you can use a default export:
|
||||
// export default function proxy(request) { ... }
|
||||
|
||||
// See "Matching Paths" below to learn more
|
||||
export const config = {
|
||||
matcher: '/about/:path*',
|
||||
}
|
||||
```
|
||||
|
||||
The `matcher` config allows you to filter Proxy to run on specific paths. See the [Matcher](/docs/app/api-reference/file-conventions/proxy#matcher) documentation for more details on path matching.
|
||||
|
||||
Read more about [using `proxy`](/docs/app/guides/backend-for-frontend#proxy), or refer to the `proxy` [API reference](/docs/app/api-reference/file-conventions/proxy).
|
||||
|
||||
@@ -195,7 +195,7 @@ Provide params ahead of time to prerender pages at build time. You can prerender
|
||||
|
||||
During the build process, the route is executed with each sample param to collect the HTML result. If dynamic content or runtime data are accessed incorrectly, the build will fail.
|
||||
|
||||
```tsx filename="app/blog/[slug]/page.tsx" highlight={5-7,10,22,24}
|
||||
```tsx filename="app/blog/[slug]/page.tsx" highlight={3-5,8,19}
|
||||
import { Suspense } from 'react'
|
||||
|
||||
export async function generateStaticParams() {
|
||||
|
||||
@@ -1217,12 +1217,11 @@ Streaming metadata at runtime while the rest of the page is fully prerenderable
|
||||
|
||||
To resolve this, you have two options. If metadata depends on external data but not runtime data, use `use cache`:
|
||||
|
||||
```tsx filename="app/blog/[slug]/page.tsx" highlight={2}
|
||||
export async function generateMetadata({ params }) {
|
||||
```tsx filename="app/page.tsx" highlight={2}
|
||||
export async function generateMetadata() {
|
||||
'use cache'
|
||||
const { slug } = await params
|
||||
const post = await db.getPost(slug)
|
||||
return { title: post.title }
|
||||
const { title, description } = await db.query('site-metadata')
|
||||
return { title, description }
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user