Skip to content

Instantly share code, notes, and snippets.

@evertjr
Created July 8, 2024 19:13
Show Gist options
  • Save evertjr/c9a475c33c8c0b66ce7d7e4748be7168 to your computer and use it in GitHub Desktop.
Save evertjr/c9a475c33c8c0b66ce7d7e4748be7168 to your computer and use it in GitHub Desktop.
// Root Layout
import type { Metadata, Viewport } from "next";
import type { Organization } from "schema-dts";
import "../../styles/globals.css";
export const metadata: Metadata = {
metadataBase: new URL(process.env.BASE_URL),
manifest: "/manifest.json",
title: "Example Title",
applicationName: "Example App",
description: "Example description",
verification: {
google: "google-site-verification-code",
},
};
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="pt-BR">
<body>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify({
"@context": "https://schema.org/",
"@type": "Organization",
name: "Example Organization",
logo: "/logo.svg",
description: "Example organization description",
contactPoint: [
{
"@type": "ContactPoint",
telephone: "1234567890",
contactType: "customer service",
areaServed: "BR",
},
],
url: "https://www.example.com/",
image: "https://example.com/image.png",
sameAs: [
"https://twitter.com/example",
"https://www.linkedin.com/company/example",
"https://www.facebook.com/example",
"https://www.youtube.com/c/example",
"https://www.instagram.com/example/",
],
address: {
"@type": "PostalAddress",
addressCountry: "Country",
streetAddress: "123 Example St",
addressLocality: "Example City",
},
} as Organization),
}}
/>
{children}
</body>
</html>
);
}
// Page
export const metadata: Metadata = {
metadataBase: new URL(process.env.BASE_URL),
title: "Example Company",
description: "Example description of the company and its services.",
openGraph: {
title: "Example Company",
description: "Brief description of services offered. Call to action.",
url: "https://www.example.com/",
images: "/img/example.jpg",
},
};
//...
return (
<>
{/* Page components */}
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify({
"@context": "https://schema.org",
"@id": "https://www.example.com/#webpage",
"@type": "WebPage",
url: "https://www.example.com/",
name: "Example Company",
}),
}}
/>
</>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment