Skip to content

Commit f12a5e3

Browse files
authored
Merge pull request #18032 from ethereum/jsonld-organization
refactor(jsonld): mv ethereum orgs to organizations.ts namespace
2 parents 836a670 + 0553bb0 commit f12a5e3

5 files changed

Lines changed: 48 additions & 51 deletions

File tree

app/[locale]/page-jsonld.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@ import { Lang } from "@/lib/types"
44

55
import PageJsonLD from "@/components/PageJsonLD"
66

7-
import { normalizeUrlForJsonLd } from "@/lib/utils/url"
8-
9-
import {
10-
ETHEREUM_ORG_WEBSITE,
11-
ORGANIZATION,
12-
REFERENCE,
13-
} from "@/lib/jsonld/constants"
7+
import { ETHEREUM_ORG_WEBSITE, REFERENCE } from "@/lib/jsonld/constants"
8+
import { KNOWN_ORGANIZATIONS } from "@/lib/jsonld/organizations"
149

1510
export default async function IndexPageJsonLD({
1611
locale,
@@ -19,16 +14,13 @@ export default async function IndexPageJsonLD({
1914
}) {
2015
const t = await getTranslations("page-index")
2116

22-
const url = normalizeUrlForJsonLd(locale, `/`)
23-
2417
const jsonLd = {
2518
"@context": "https://schema.org",
2619
"@graph": [
27-
ORGANIZATION.ETHEREUM_FOUNDATION,
28-
ORGANIZATION.ETHEREUM_COMMUNITY,
20+
KNOWN_ORGANIZATIONS["ethereum-foundation"],
21+
KNOWN_ORGANIZATIONS["ethereum-community"],
2922
{
3023
...ETHEREUM_ORG_WEBSITE,
31-
url: url,
3224
description: t("page-index-meta-description"),
3325
educationalUse: "Self-Paced",
3426
keywords:

src/lib/jsonld/constants.ts

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* These can be imported and reused across page-jsonld.tsx files
44
*/
55

6+
import { KNOWN_ORGANIZATIONS } from "./organizations"
7+
68
export const REFERENCE = {
79
/**
810
* Reference to Ethereum Foundation organization (for use when the full object is already defined elsewhere)
@@ -18,37 +20,6 @@ export const REFERENCE = {
1820
ETHEREUM_ORG_WEBSITE: { "@id": "https://ethereum.org/#website" },
1921
} as const
2022

21-
export const ORGANIZATION = {
22-
/**
23-
* Ethereum Foundation organization definition
24-
* Can be used as publisher, maintainer, author, etc.
25-
*/
26-
ETHEREUM_FOUNDATION: {
27-
"@type": "Organization" as const,
28-
name: "Ethereum Foundation",
29-
url: "https://ethereum.foundation",
30-
ownershipFundingInfo: "https://ethereum.foundation/ef",
31-
logo: "https://ethereum.org/images/ef-logo.png",
32-
sameAs: [
33-
"https://www.wikidata.org/wiki/Q114736857",
34-
"https://www.crunchbase.com/organization/ethereum",
35-
"https://x.com/ethereumfndn",
36-
"https://www.linkedin.com/company/ethereum-foundation",
37-
],
38-
...REFERENCE.ETHEREUM_FOUNDATION,
39-
},
40-
/**
41-
* Ethereum Community contributor organization
42-
*/
43-
ETHEREUM_COMMUNITY: {
44-
"@type": "Organization" as const,
45-
name: "Ethereum Community",
46-
url: "https://github.com/ethereum/ethereum-org-website/graphs/contributors",
47-
description: "A global collective of open-source contributors.",
48-
...REFERENCE.ETHEREUM_COMMUNITY,
49-
},
50-
}
51-
5223
/**
5324
* ethereum.org WebSite entity
5425
* Anchors the site in the knowledge graph. Every page's JSON-LD graph
@@ -69,7 +40,7 @@ export const ETHEREUM_ORG_WEBSITE = {
6940
* same graph.
7041
*/
7142
export const BASE_GRAPH_NODES = [
72-
ORGANIZATION.ETHEREUM_FOUNDATION,
73-
ORGANIZATION.ETHEREUM_COMMUNITY,
43+
KNOWN_ORGANIZATIONS["ethereum-foundation"],
44+
KNOWN_ORGANIZATIONS["ethereum-community"],
7445
ETHEREUM_ORG_WEBSITE,
7546
]

src/lib/jsonld/organizations.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { REFERENCE } from "./constants"
2+
13
/**
24
* Known Organization profiles for JSON-LD attribution
35
*
@@ -6,6 +8,39 @@
68
* (e.g. podcasts, video channels, events).
79
*/
810
export const KNOWN_ORGANIZATIONS = {
11+
/**
12+
* Ethereum Foundation organization definition
13+
* Can be used as publisher, maintainer, author, etc.
14+
*/
15+
"ethereum-foundation": {
16+
"@type": "Organization" as const,
17+
name: "Ethereum Foundation",
18+
url: "https://ethereum.foundation",
19+
ownershipFundingInfo: "https://ethereum.foundation/ef",
20+
logo: "https://ethereum.org/images/ef-logo.png",
21+
sameAs: [
22+
"https://www.wikidata.org/wiki/Q114736857",
23+
"https://www.crunchbase.com/organization/ethereum",
24+
"https://x.com/ethereumfndn",
25+
"https://www.linkedin.com/company/ethereum-foundation",
26+
],
27+
...REFERENCE.ETHEREUM_FOUNDATION,
28+
},
29+
30+
/**
31+
* Ethereum Community contributor organization
32+
*/
33+
"ethereum-community": {
34+
"@type": "Organization" as const,
35+
name: "Ethereum Community",
36+
url: "https://github.com/ethereum/ethereum-org-website/graphs/contributors",
37+
description: "A global collective of open-source contributors.",
38+
...REFERENCE.ETHEREUM_COMMUNITY,
39+
},
40+
41+
/**
42+
* Other known organizations
43+
*/
944
bankless: {
1045
"@type": "Organization" as const,
1146
"@id": "https://ethereum.org/#bankless",

src/lib/jsonld/types.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { ORGANIZATION } from "./constants"
21
import { KNOWN_ORGANIZATIONS } from "./organizations"
32
import { KNOWN_PERSONS } from "./persons"
43

54
export type KnownEntity =
65
| (typeof KNOWN_PERSONS)[keyof typeof KNOWN_PERSONS]
76
| (typeof KNOWN_ORGANIZATIONS)[keyof typeof KNOWN_ORGANIZATIONS]
8-
| typeof ORGANIZATION.ETHEREUM_FOUNDATION
9-
| typeof ORGANIZATION.ETHEREUM_COMMUNITY
7+
| (typeof KNOWN_ORGANIZATIONS)["ethereum-foundation"]
8+
| (typeof KNOWN_ORGANIZATIONS)["ethereum-community"]

src/lib/jsonld/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Sentry from "@sentry/nextjs"
22

3-
import { ORGANIZATION, REFERENCE } from "./constants"
3+
import { REFERENCE } from "./constants"
44
import { KNOWN_ORGANIZATIONS } from "./organizations"
55
import { KNOWN_PERSONS } from "./persons"
66
import type { KnownEntity } from "./types"
@@ -49,8 +49,8 @@ function buildEntityAliases(): Record<string, KnownEntity> {
4949
}
5050

5151
const entries: Array<[string | null, KnownEntity]> = [
52-
[null, ORGANIZATION.ETHEREUM_FOUNDATION],
53-
[null, ORGANIZATION.ETHEREUM_COMMUNITY],
52+
[null, KNOWN_ORGANIZATIONS["ethereum-foundation"]],
53+
[null, KNOWN_ORGANIZATIONS["ethereum-community"]],
5454
...Object.entries(KNOWN_PERSONS),
5555
...Object.entries(KNOWN_ORGANIZATIONS),
5656
]

0 commit comments

Comments
 (0)