You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/01-app/01-getting-started/14-metadata-and-og-images.mdx
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,8 @@ The Metadata APIs can be used to define your application metadata for improved S
23
23
24
24
With all the options above, Next.js will automatically generate the relevant `<head>` tags for your page, which can be inspected in the browser's developer tools.
25
25
26
+
The `metadata` object and `generateMetadata` function exports are only supported in Server Components.
27
+
26
28
## Default fields
27
29
28
30
There are two default `meta` tags that are always added even if a route doesn't define metadata:
Copy file name to clipboardExpand all lines: docs/01-app/02-guides/progressive-web-apps.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -648,7 +648,7 @@ Let’s go over each of these options:
648
648
649
649
Learn more about defining [Content Security Policies](/docs/app/guides/content-security-policy) with Next.js.
650
650
651
-
## Next Steps
651
+
## Extending your PWA
652
652
653
653
1. **Exploring PWA Capabilities**: PWAs can leverage various web APIs to provide advanced functionality. Consider exploring features like background sync, periodic background sync, or the File System Access API to enhance your application. For inspiration and up-to-date information on PWA capabilities, you can refer to resources like [What PWA Can Do Today](https://whatpwacando.today/).
654
654
2. **Static Exports:** If your application requires not running a server, and instead using a static export of files, you can update the Next.js configuration to enable this change. Learn more in the [Next.js Static Export documentation](/docs/app/guides/static-exports). However, you will need to move from Server Actions to calling an external API, as well as moving your defined headers to your proxy.
While less common, you can handle errors in the root layout or template using `global-error.js`, located in the root app directory, even when leveraging [internationalization](/docs/app/guides/internationalization). Global error UI must define its own `<html>` and `<body>` tags. This file replaces the root layout or template when active.
156
+
While less common, you can handle errors in the root layout or template using `global-error.js`, located in the root app directory, even when leveraging [internationalization](/docs/app/guides/internationalization). Global error UI must define its own `<html>` and `<body>` tags, global styles, fonts, or other dependencies that your error page requires. This file replaces the root layout or template when active.
157
+
158
+
> **Good to know**: Error boundaries must be [Client Components](/docs/app/getting-started/server-and-client-components#using-client-components), which means that [`metadata` and `generateMetadata`](/docs/app/getting-started/metadata-and-og-images) exports are not supported in `global-error.js`. As an alternative, you can use the React [`<title>`](https://react.dev/reference/react-dom/components/title) component.
157
159
158
160
```tsx filename="app/global-error.tsx" switcher
159
161
'use client'// Error boundaries must be Client Components
Copy file name to clipboardExpand all lines: docs/01-app/03-api-reference/04-functions/revalidatePath.mdx
+15-5Lines changed: 15 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,17 @@ The path parameter can point to pages, layouts, or route handlers:
35
35
36
36
-**Pages**: Revalidates the specific page
37
37
-**Layouts**: Revalidates the layout and all pages beneath it
38
-
-**GET Route Handlers**: Only if they're statically generated
38
+
-**Route Handlers**: Revalidates Data Cache entries accessed within route handlers. For example `revalidatePath("/api/data")` revalidates this GET handler:
39
+
40
+
```ts filename="app/api/data/route.ts"
41
+
exportasyncfunction GET() {
42
+
const data =awaitfetch('https://api.vercel.app/blog', {
43
+
cache: 'force-cache',
44
+
})
45
+
46
+
returnResponse.json(awaitdata.json())
47
+
}
48
+
```
39
49
40
50
## Relationship with `revalidateTag`
41
51
@@ -84,7 +94,7 @@ This pattern ensures that both the specific page and any other pages using the s
84
94
85
95
## Examples
86
96
87
-
### Revalidating A Specific URL
97
+
### Revalidating a specific URL
88
98
89
99
```ts
90
100
import { revalidatePath } from'next/cache'
@@ -93,7 +103,7 @@ revalidatePath('/blog/post-1')
93
103
94
104
This will revalidate one specific URL on the next page visit.
This will revalidate any URL that matches the provided `page` file on the next page visit. This will _not_ invalidate pages beneath the specific page. For example, `/blog/[slug]` won't invalidate `/blog/[slug]/[author]`.
This will revalidate any URL that matches the provided `layout` file on the next page visit. This will cause pages beneath with the same layout to revalidate on the next visit. For example, in the above case, `/blog/[slug]/[another]` would also revalidate on the next visit.
0 commit comments