Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 49 additions & 77 deletions app/[locale]/10years/page-jsonld.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { FileContributor } from "@/lib/types"

import PageJsonLD from "@/components/PageJsonLD"

import {
ethereumCommunityOrganization,
ethereumFoundationOrganization,
} from "@/lib/utils/jsonld"
import { normalizeUrlForJsonLd } from "@/lib/utils/url"

export default async function TenYearJsonLD({
Expand All @@ -25,89 +29,57 @@ export default async function TenYearJsonLD({
url: contributor.html_url,
}))

const webPageJsonLd = {
const jsonLd = {
"@context": "https://schema.org",
"@type": "WebPage",
"@id": url,
name: t("page-10-year-anniversary-meta-title"),
description: t("page-10-year-anniversary-meta-description"),
url: url,
inLanguage: locale,
author: [
"@graph": [
{
"@type": "Organization",
name: "ethereum.org",
url: "https://ethereum.org",
},
],
contributor: contributorList,
breadcrumb: {
"@type": "BreadcrumbList",
itemListElement: [
{
"@type": "ListItem",
position: 1,
name: "Home",
item: normalizeUrlForJsonLd(locale, "/"),
"@type": "WebPage",
"@id": url,
name: t("page-10-year-anniversary-meta-title"),
description: t("page-10-year-anniversary-meta-description"),
url: url,
inLanguage: locale,
author: [ethereumCommunityOrganization],
contributor: contributorList,
isPartOf: {
"@type": "WebSite",
name: "ethereum.org",
url: "https://ethereum.org",
},
{
"@type": "ListItem",
position: 2,
name: t("page-10-year-anniversary-meta-title"),
item: url,
breadcrumb: {
"@type": "BreadcrumbList",
itemListElement: [
{
"@type": "ListItem",
position: 1,
name: "Home",
item: normalizeUrlForJsonLd(locale, "/"),
},
{
"@type": "ListItem",
position: 2,
name: t("page-10-year-anniversary-meta-title"),
item: url,
},
],
},
],
},
publisher: {
"@type": "Organization",
name: "ethereum.org",
url: "https://ethereum.org",
logo: {
"@type": "ImageObject",
url: "https://ethereum.org/assets/eth-logo.png",
width: "256",
height: "417",
publisher: ethereumFoundationOrganization,
reviewedBy: ethereumFoundationOrganization,
mainEntity: { "@id": `${url}#video` },
},
},
reviewedBy: {
"@type": "Organization",
name: "ethereum.org",
url: "https://ethereum.org",
logo: {
"@type": "ImageObject",
url: "https://ethereum.org/images/eth-home-icon.png",
},
},
mainEntity: {
"@type": "Event",
"@id": `${url}#ethereum-10-year-anniversary`,
},
}

const videoJsonLd = {
"@context": "https://schema.org",
"@type": "VideoObject",
name: "Ethereum: 10 Years Anniversary",
description: t("page-10-year-anniversary-meta-description"),
thumbnailUrl: "https://i.ytimg.com/vi/gjwr-7PgpTC/maxresdefault.jpg",
uploadDate: "2024-07-30T00:00:00Z",
duration: "PT5M30S",
embedUrl: "https://www.youtube.com/embed/gjwr-7PgpTC",
publisher: {
"@type": "Organization",
name: "Ethereum Foundation",
url: "https://ethereum.org",
},
reviewedBy: {
"@type": "Organization",
name: "ethereum.org",
url: "https://ethereum.org",
logo: {
"@type": "ImageObject",
url: "https://ethereum.org/images/eth-home-icon.png",
{
"@type": "VideoObject",
name: "Ethereum: 10 Years Anniversary",
description: t("page-10-year-anniversary-meta-description"),
thumbnailUrl: "https://i.ytimg.com/vi/gjwr-7PgpTC/maxresdefault.jpg",
uploadDate: "2024-07-30T00:00:00Z",
duration: "PT5M30S",
embedUrl: "https://www.youtube.com/embed/gjwr-7PgpTC",
publisher: ethereumFoundationOrganization,
reviewedBy: ethereumFoundationOrganization,
},
},
],
}

return <PageJsonLD structuredData={[webPageJsonLd, videoJsonLd]} />
return <PageJsonLD structuredData={jsonLd} />
}
121 changes: 46 additions & 75 deletions app/[locale]/[...slug]/page-jsonld.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { FileContributor, Frontmatter } from "@/lib/types"

import PageJsonLD from "@/components/PageJsonLD"

import {
ethereumCommunityOrganization,
ethereumFoundationOrganization,
} from "@/lib/utils/jsonld"
import { normalizeUrlForJsonLd } from "@/lib/utils/url"

export default async function SlugJsonLD({
Expand Down Expand Up @@ -48,87 +52,54 @@ export default async function SlugJsonLD({
url: contributor.html_url,
}))

// JSON-LD structured data for the slug page
const webPageJsonLd = {
const jsonLd = {
"@context": "https://schema.org",
"@type": "WebPage",
"@id": url,
name: frontmatter.title,
description: frontmatter.description,
url: url,
inLanguage: locale,
author: [
"@graph": [
{
"@type": "Organization",
name: "ethereum.org",
url: "https://ethereum.org",
"@type": "WebPage",
"@id": url,
name: frontmatter.title,
description: frontmatter.description,
url: url,
inLanguage: locale,
author: [ethereumCommunityOrganization],
contributor: contributorList,
isPartOf: {
"@type": "WebSite",
"@id": "https://ethereum.org/#website",
name: "ethereum.org",
url: "https://ethereum.org",
},
breadcrumb: {
"@type": "BreadcrumbList",
itemListElement: breadcrumbItems,
},
publisher: ethereumFoundationOrganization,
reviewedBy: ethereumFoundationOrganization,
mainEntity: { "@id": `${url}#article` },
},
],
contributor: contributorList,
isPartOf: {
"@type": "WebSite",
name: "ethereum.org",
url: "https://ethereum.org",
},
breadcrumb: {
"@type": "BreadcrumbList",
itemListElement: breadcrumbItems,
},
publisher: {
"@type": "Organization",
name: "ethereum.org",
url: "https://ethereum.org",
},
reviewedBy: {
"@type": "Organization",
name: "ethereum.org",
url: "https://ethereum.org",
logo: {
"@type": "ImageObject",
url: "https://ethereum.org/images/eth-home-icon.png",
},
},
}

// JSON-LD for the article content
const articleJsonLd = {
"@context": "https://schema.org",
"@type": "Article",
headline: frontmatter.title,
description: frontmatter.description,
image: frontmatter.image
? `https://ethereum.org${frontmatter.image}`
: undefined,
author: [
{
"@type": "Organization",
name: "ethereum.org",
url: "https://ethereum.org",
"@type": "Article",
"@id": `${url}#article`,
headline: frontmatter.title,
description: frontmatter.description,
image: frontmatter.image
? `https://ethereum.org${frontmatter.image}`
: undefined,
author: [ethereumCommunityOrganization],
contributor: contributorList,
publisher: ethereumFoundationOrganization,
reviewedBy: ethereumFoundationOrganization,
dateModified: frontmatter.published,
mainEntityOfPage: url,
about: {
"@type": "Thing",
name: frontmatter.title,
description: frontmatter.description,
},
},
],
contributor: contributorList,
publisher: {
"@type": "Organization",
name: "ethereum.org",
url: "https://ethereum.org",
},
reviewedBy: {
"@type": "Organization",
name: "ethereum.org",
url: "https://ethereum.org",
logo: {
"@type": "ImageObject",
url: "https://ethereum.org/images/eth-home-icon.png",
},
},
dateModified: frontmatter.published,
mainEntityOfPage: url,
about: {
"@type": "Thing",
name: frontmatter.title,
description: frontmatter.description,
},
}

return <PageJsonLD structuredData={[webPageJsonLd, articleJsonLd]} />
return <PageJsonLD structuredData={jsonLd} />
}
Loading