Skip to content
Open
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
16 changes: 4 additions & 12 deletions app/[locale]/page-jsonld.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ import { Lang } from "@/lib/types"

import PageJsonLD from "@/components/PageJsonLD"

import { normalizeUrlForJsonLd } from "@/lib/utils/url"

import {
ETHEREUM_ORG_WEBSITE,
ORGANIZATION,
REFERENCE,
} from "@/lib/jsonld/constants"
import { ETHEREUM_ORG_WEBSITE, REFERENCE } from "@/lib/jsonld/constants"
import { KNOWN_ORGANIZATIONS } from "@/lib/jsonld/organizations"

export default async function IndexPageJsonLD({
locale,
Expand All @@ -19,16 +14,13 @@ export default async function IndexPageJsonLD({
}) {
const t = await getTranslations("page-index")

const url = normalizeUrlForJsonLd(locale, `/`)

const jsonLd = {
"@context": "https://schema.org",
"@graph": [
ORGANIZATION.ETHEREUM_FOUNDATION,
ORGANIZATION.ETHEREUM_COMMUNITY,
KNOWN_ORGANIZATIONS["ethereum-foundation"],
KNOWN_ORGANIZATIONS["ethereum-community"],
{
...ETHEREUM_ORG_WEBSITE,
url: url,
description: t("page-index-meta-description"),
educationalUse: "Self-Paced",
keywords:
Expand Down
37 changes: 4 additions & 33 deletions src/lib/jsonld/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* These can be imported and reused across page-jsonld.tsx files
*/

import { KNOWN_ORGANIZATIONS } from "./organizations"

export const REFERENCE = {
/**
* Reference to Ethereum Foundation organization (for use when the full object is already defined elsewhere)
Expand All @@ -18,37 +20,6 @@ export const REFERENCE = {
ETHEREUM_ORG_WEBSITE: { "@id": "https://ethereum.org/#website" },
} as const

export const ORGANIZATION = {
/**
* Ethereum Foundation organization definition
* Can be used as publisher, maintainer, author, etc.
*/
ETHEREUM_FOUNDATION: {
"@type": "Organization" as const,
name: "Ethereum Foundation",
url: "https://ethereum.foundation",
ownershipFundingInfo: "https://ethereum.foundation/ef",
logo: "https://ethereum.org/images/ef-logo.png",
sameAs: [
"https://www.wikidata.org/wiki/Q114736857",
"https://www.crunchbase.com/organization/ethereum",
"https://x.com/ethereumfndn",
"https://www.linkedin.com/company/ethereum-foundation",
],
...REFERENCE.ETHEREUM_FOUNDATION,
},
/**
* Ethereum Community contributor organization
*/
ETHEREUM_COMMUNITY: {
"@type": "Organization" as const,
name: "Ethereum Community",
url: "https://github.com/ethereum/ethereum-org-website/graphs/contributors",
description: "A global collective of open-source contributors.",
...REFERENCE.ETHEREUM_COMMUNITY,
},
}

/**
* ethereum.org WebSite entity
* Anchors the site in the knowledge graph. Every page's JSON-LD graph
Expand All @@ -69,7 +40,7 @@ export const ETHEREUM_ORG_WEBSITE = {
* same graph.
*/
export const BASE_GRAPH_NODES = [
ORGANIZATION.ETHEREUM_FOUNDATION,
ORGANIZATION.ETHEREUM_COMMUNITY,
KNOWN_ORGANIZATIONS["ethereum-foundation"],
KNOWN_ORGANIZATIONS["ethereum-community"],
ETHEREUM_ORG_WEBSITE,
]
35 changes: 35 additions & 0 deletions src/lib/jsonld/organizations.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { REFERENCE } from "./constants"

/**
* Known Organization profiles for JSON-LD attribution
*
Expand All @@ -6,6 +8,39 @@
* (e.g. podcasts, video channels, events).
*/
export const KNOWN_ORGANIZATIONS = {
/**
* Ethereum Foundation organization definition
* Can be used as publisher, maintainer, author, etc.
*/
"ethereum-foundation": {
"@type": "Organization" as const,
name: "Ethereum Foundation",
url: "https://ethereum.foundation",
ownershipFundingInfo: "https://ethereum.foundation/ef",
logo: "https://ethereum.org/images/ef-logo.png",
sameAs: [
"https://www.wikidata.org/wiki/Q114736857",
"https://www.crunchbase.com/organization/ethereum",
"https://x.com/ethereumfndn",
"https://www.linkedin.com/company/ethereum-foundation",
],
...REFERENCE.ETHEREUM_FOUNDATION,
},

/**
* Ethereum Community contributor organization
*/
"ethereum-community": {
"@type": "Organization" as const,
name: "Ethereum Community",
url: "https://github.com/ethereum/ethereum-org-website/graphs/contributors",
description: "A global collective of open-source contributors.",
...REFERENCE.ETHEREUM_COMMUNITY,
},

/**
* Other known organizations
*/
bankless: {
"@type": "Organization" as const,
"@id": "https://ethereum.org/#bankless",
Expand Down
5 changes: 2 additions & 3 deletions src/lib/jsonld/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { ORGANIZATION } from "./constants"
import { KNOWN_ORGANIZATIONS } from "./organizations"
import { KNOWN_PERSONS } from "./persons"

export type KnownEntity =
| (typeof KNOWN_PERSONS)[keyof typeof KNOWN_PERSONS]
| (typeof KNOWN_ORGANIZATIONS)[keyof typeof KNOWN_ORGANIZATIONS]
| typeof ORGANIZATION.ETHEREUM_FOUNDATION
| typeof ORGANIZATION.ETHEREUM_COMMUNITY
| (typeof KNOWN_ORGANIZATIONS)["ethereum-foundation"]
| (typeof KNOWN_ORGANIZATIONS)["ethereum-community"]
6 changes: 3 additions & 3 deletions src/lib/jsonld/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Sentry from "@sentry/nextjs"

import { ORGANIZATION, REFERENCE } from "./constants"
import { REFERENCE } from "./constants"
import { KNOWN_ORGANIZATIONS } from "./organizations"
import { KNOWN_PERSONS } from "./persons"
import type { KnownEntity } from "./types"
Expand Down Expand Up @@ -49,8 +49,8 @@ function buildEntityAliases(): Record<string, KnownEntity> {
}

const entries: Array<[string | null, KnownEntity]> = [
[null, ORGANIZATION.ETHEREUM_FOUNDATION],
[null, ORGANIZATION.ETHEREUM_COMMUNITY],
[null, KNOWN_ORGANIZATIONS["ethereum-foundation"]],
[null, KNOWN_ORGANIZATIONS["ethereum-community"]],
...Object.entries(KNOWN_PERSONS),
...Object.entries(KNOWN_ORGANIZATIONS),
]
Expand Down
Loading