From 9ea188a06f4717ee8307d969dccdfa19ff87dc40 Mon Sep 17 00:00:00 2001 From: Carlos Menezes Date: Mon, 10 Jul 2023 10:19:59 +0100 Subject: [PATCH] chore(docs): Typesafe `metadata` object (#52252) Adds missing `Metadata` type to a few declarations. --------- Co-authored-by: Steven Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com> Co-authored-by: Tim Neutkens --- .../04-functions/generate-metadata.mdx | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/02-app/02-api-reference/04-functions/generate-metadata.mdx b/docs/02-app/02-api-reference/04-functions/generate-metadata.mdx index 69bfc89363cf..21ff66173de9 100644 --- a/docs/02-app/02-api-reference/04-functions/generate-metadata.mdx +++ b/docs/02-app/02-api-reference/04-functions/generate-metadata.mdx @@ -177,9 +177,7 @@ export const metadata: Metadata = { ``` ```jsx filename="app/layout.js" switcher -import { Metadata } from 'next' - -export const metadata: Metadata = { +export const metadata = { title: { default: '...', template: '...', @@ -193,7 +191,9 @@ export const metadata: Metadata = { `title.default` can be used to provide a **fallback title** to child route segments that don't define a `title`. ```tsx filename="app/layout.tsx" -export const metadata = { +import type { Metadata } from 'next' + +export const metadata: Metadata = { title: { default: 'Acme', }, @@ -201,7 +201,9 @@ export const metadata = { ``` ```tsx filename="app/about/page.tsx" -export const metadata = {} +import type { Metadata } from 'next' + +export const metadata: Metadata = {} // Output: Acme ``` @@ -222,9 +224,7 @@ export const metadata: Metadata = { ``` ```jsx filename="app/layout.js" switcher -import { Metadata } from 'next' - -export const metadata: Metadata = { +export const metadata = { title: { template: '%s | Acme', default: 'Acme', // a default is required when creating a template @@ -243,9 +243,7 @@ export const metadata: Metadata = { ``` ```jsx filename="app/about/page.js" switcher -import { Metadata } from 'next' - -export const metadata: Metadata = { +export const metadata = { title: 'About', } @@ -520,7 +518,9 @@ export const metadata = { ### `robots` ```tsx -export const metadata = { +import type { Metadata } from 'next' + +export const metadata: Metadata = { robots: { index: false, follow: true,