import type { AlternateURLs, ResolvedAlternateURLs } from './alternative-urls-types'; import type { AppleWebApp, AppLinks, FormatDetection, ItunesApp, ResolvedAppleWebApp, ResolvedAppLinks, Viewport } from './extra-types'; import type { DeprecatedMetadataFields, AbsoluteTemplateString, Author, ColorSchemeEnum, Icon, Icons, IconURL, ReferrerEnum, ResolvedIcons, ResolvedVerification, Robots, ResolvedRobots, TemplateString, Verification, ThemeColorDescriptor } from './metadata-types'; import type { OpenGraph, ResolvedOpenGraph } from './opengraph-types'; import type { ResolvedTwitterMetadata, Twitter } from './twitter-types'; /** * Metadata interface to describe all the metadata fields that can be set in a document. * @interface */ interface Metadata extends DeprecatedMetadataFields { /** * The base path and origin for absolute urls for various metadata links such as OpenGraph images. */ metadataBase?: null | URL; /** * The document title. * @example * ```tsx * "My Blog" * My Blog * * { default: "Dashboard", template: "%s | My Website" } * Dashboard | My Website * * { absolute: "My Blog", template: "%s | My Website" } * My Blog * ``` */ title?: null | string | TemplateString; /** * The document description, and optionally the OpenGraph and twitter descriptions. * @example * ```tsx * "My Blog Description" * * ``` */ description?: null | string; /** * The application name. * @example * ```tsx * "My Blog" * * ``` */ applicationName?: null | string; /** * The authors of the document. * @example * ```tsx * [{ name: "Next.js Team", url: "https://nextjs.org" }] * * * * ``` */ authors?: null | Author | Array; /** * The generator used for the document. * @example * ```tsx * "Next.js" * * * ``` */ generator?: null | string; /** * The keywords for the document. If an array is provided, it will be flattened into a single tag with comma separation. * @example * ```tsx * "nextjs, react, blog" * * * ["react", "server components"] * * ``` */ keywords?: null | string | Array; /** * The referrer setting for the document. * @example * ```tsx * "origin" * * ``` */ referrer?: null | ReferrerEnum; /** * The theme color for the document. * @example * ```tsx * "#000000" * * * { media: "(prefers-color-scheme: dark)", color: "#000000" } * * * [ * { media: "(prefers-color-scheme: dark)", color: "#000000" }, * { media: "(prefers-color-scheme: light)", color: "#ffffff" } * ] * * * ``` */ themeColor?: null | string | ThemeColorDescriptor | ThemeColorDescriptor[]; /** * The color scheme for the document. * @example * ```tsx * "dark" * * ``` */ colorScheme?: null | ColorSchemeEnum; /** * The viewport setting for the document. * @example * ```tsx * "width=device-width, initial-scale=1" * * * { width: "device-width", initialScale: 1 } * * ``` */ viewport?: null | string | Viewport; /** * The creator of the document. * @example * ```tsx * "Next.js Team" * * ``` */ creator?: null | string; /** * The publisher of the document. * @example * * ```tsx * "Vercel" * * ``` */ publisher?: null | string; /** * The robots setting for the document. * * @see https://developer.mozilla.org/en-US/docs/Glossary/Robots.txt * @example * ```tsx * "index, follow" * * * { index: false, follow: false } * * ``` */ robots?: null | string | Robots; /** * The canonical and alternate URLs for the document. * @example * ```tsx * { canonical: "https://example.com" } * * * { canonical: "https://example.com", hreflang: { "en-US": "https://example.com/en-US" } } * * * ``` * * Multiple titles example for alternate URLs except `canonical`: * ```tsx * { * canonical: "https://example.com", * types: { * 'application/rss+xml': [ * { url: 'blog.rss', title: 'rss' }, * { url: 'blog/js.rss', title: 'js title' }, * ], * }, * } * * * * ``` */ alternates?: null | AlternateURLs; /** * The icons for the document. Defaults to rel="icon". * * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel#attr-icon * @example * ```tsx * "https://example.com/icon.png" * * * { icon: "https://example.com/icon.png", apple: "https://example.com/apple-icon.png" } * * * * [{ rel: "icon", url: "https://example.com/icon.png" }, { rel: "apple-touch-icon", url: "https://example.com/apple-icon.png" }] * * * ``` */ icons?: null | IconURL | Array | Icons; /** * A web application manifest, as defined in the Web Application Manifest specification. * * @see https://developer.mozilla.org/en-US/docs/Web/Manifest * @example * ```tsx * "https://example.com/manifest.json" * * ``` * */ manifest?: null | string | URL; /** * The Open Graph metadata for the document. * * @see https://ogp.me * @example * ```tsx * { * type: "website", * url: "https://example.com", * title: "My Website", * description: "My Website Description", * siteName: "My Website", * images: [{ * url: "https://example.com/og.png", * }], * } * * * * * * * * ``` */ openGraph?: null | OpenGraph; /** * The Twitter metadata for the document. * @example * ```tsx * { card: "summary_large_image", site: "@site", creator: "@creator", "images": "https://example.com/og.png" } * * * * * * * * ``` * */ twitter?: null | Twitter; /** * The common verification tokens for the document. * @example * ```tsx * { verification: { google: "google-site-verification=1234567890", yandex: "1234567890", "me": "1234567890" } } * * * * ``` */ verification?: Verification; /** * The Apple web app metadata for the document. * * @see https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html * @example * ```tsx * { capable: true, title: "My Website", statusBarStyle: "black-translucent" } * * * * ``` * */ appleWebApp?: null | boolean | AppleWebApp; /** * Indicates if devices should try to interpret various formats and make actionable links out of them. For example it controles * if telephone numbers on mobile that can be clicked to dial or not. * @example * ```tsx * { telephone: false } * * ``` * */ formatDetection?: null | FormatDetection; /** * The metadata for the iTunes App. * It adds the `name="apple-itunes-app"` meta tag. * * @example * ```tsx * { app: { id: "123456789", affiliateData: "123456789", appArguments: "123456789" } } * * ``` */ itunes?: null | ItunesApp; /** * A brief description of what this web-page is about. Not recommended, superseded by description. * It adds the `name="abstract"` meta tag. * * @see https://www.metatags.org/all-meta-tags-overview/meta-name-abstract/ * @example * ```tsx * "My Website Description" * * ``` */ abstract?: null | string; /** * The Facebook AppLinks metadata for the document. * @example * ```tsx * { ios: { appStoreId: "123456789", url: "https://example.com" }, android: { packageName: "com.example", url: "https://example.com" } } * * * * * * ``` */ appLinks?: null | AppLinks; /** * The archives link rel property. * @example * ```tsx * { archives: "https://example.com/archives" } * * ``` */ archives?: null | string | Array; /** * The assets link rel property. * @example * ```tsx * "https://example.com/assets" * * ``` */ assets?: null | string | Array; /** * The bookmarks link rel property. * @example * ```tsx * "https://example.com/bookmarks" * * ``` */ bookmarks?: null | string | Array; /** * The category meta name property. * @example * ```tsx * "My Category" * * ``` */ category?: null | string; /** * The classification meta name property. * @example * ```tsx * "My Classification" * * ``` */ classification?: null | string; /** * Arbitrary name/value pairs for the document. */ other?: { [name: string]: string | number | Array; } & DeprecatedMetadataFields; } interface ResolvedMetadata extends DeprecatedMetadataFields { metadataBase: null | URL; title: null | AbsoluteTemplateString; description: null | string; applicationName: null | string; authors: null | Array; generator: null | string; keywords: null | Array; referrer: null | ReferrerEnum; themeColor: null | ThemeColorDescriptor[]; colorScheme: null | ColorSchemeEnum; viewport: null | string; creator: null | string; publisher: null | string; robots: null | ResolvedRobots; alternates: null | ResolvedAlternateURLs; icons: null | ResolvedIcons; openGraph: null | ResolvedOpenGraph; manifest: null | string | URL; twitter: null | ResolvedTwitterMetadata; verification: null | ResolvedVerification; appleWebApp: null | ResolvedAppleWebApp; formatDetection: null | FormatDetection; itunes: null | ItunesApp; abstract: null | string; appLinks: null | ResolvedAppLinks; archives: null | Array; assets: null | Array; bookmarks: null | Array; category: null | string; classification: null | string; other: null | ({ [name: string]: string | number | Array; } & DeprecatedMetadataFields); } export declare type ResolvingMetadata = Promise; export { Metadata, ResolvedMetadata };