GenerateMetadata con NextJS 13.4 SEO.
toscadev
@ ToscaDevsJS
App
/layout.tsximport { Metadata } from "next";
// either Static metadata
export const metadata: Metadata = {
generator: "Next.js",
applicationName: "Next.js",
referrer: "origin-when-cross-origin",
title: "...",
description: "....",
keywords: ["...", "...", "..."],
authors: [
{
name: "JhonDoe",
url: "https://JhonDoe.com",
},
],
creator: "JhonDoe",
colorScheme: "dark",
creator: "JhonDoe",
publisher: "JhonDoe",
formatDetection: {
email: false,
address: false,
telephone: false,
},
};
Salida 😁
HTML
/index.html<meta name="application-name" content="Next.js" />
<meta name="author" content="Seb" />
<link rel="author" href="https://nextjs.org" />
<meta name="author" content="Josh" />
<meta name="generator" content="Next.js" />
<meta name="keywords" content="Next.js,React,JavaScript" />
<meta name="referrer" content="origin-when-cross-origin" />
<meta name="color-scheme" content="dark" />
<meta name="creator" content="Jiachi Liu" />
<meta name="publisher" content="Sebastian Markbåge" />
<meta name="format-detection" content="telephone=no, address=no, email=no" />
Dentro de algun directorio actualizamos los header declarandolas directamentes.
App
/directorio/page.tsxexport const metadata = {
title: "ToscaDevJS / Login",
};
nota: Las exportaciones de objetos Metadata y funciones sólo se admiten en componentes de servidor.
opengraph-image
twitter-image
publicacion en desarrollo