-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathDocsJsonLd.tsx
More file actions
89 lines (80 loc) · 2.45 KB
/
Copy pathDocsJsonLd.tsx
File metadata and controls
89 lines (80 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { useRouter } from 'vocs'
const tempoSameAs = [
'https://x.com/tempo',
'https://twitter.com/tempo',
'https://github.com/tempoxyz',
'https://www.linkedin.com/company/tempoxyz',
'https://www.crunchbase.com/organization/tempo-87e4',
]
const tempoKnowsAbout = [
'stablecoin payments',
'cross-border payments',
'global payouts',
'agentic payments',
'machine payments',
'enterprise settlement',
'payment blockchains',
'Layer 1 blockchain',
'stablecoin infrastructure',
]
const description =
'Tempo is a payments-first Layer 1 blockchain incubated by Stripe and Paradigm. Tempo documentation covers stablecoin payments, global payouts, agentic payments, APIs, wallets, and protocol specifications.'
type DocsJsonLdOptions = {
path?: string
}
export function createDocsJsonLdSchema(options: DocsJsonLdOptions = {}) {
const path = options.path || '/docs'
const pathname = path.startsWith('/') ? path : `/${path}`
const url = `https://docs.tempo.xyz${pathname}`
return {
'@context': 'https://schema.org',
'@graph': [
{
'@type': 'Organization',
'@id': 'https://tempo.xyz/#organization',
name: 'Tempo',
url: 'https://tempo.xyz',
description,
sameAs: tempoSameAs,
knowsAbout: tempoKnowsAbout,
},
{
'@type': 'WebSite',
'@id': 'https://docs.tempo.xyz/#website',
name: 'Tempo Docs',
url: 'https://docs.tempo.xyz',
description,
publisher: { '@id': 'https://tempo.xyz/#organization' },
},
{
'@type': 'TechArticle',
'@id': url,
url,
headline: 'Tempo documentation',
description,
isPartOf: { '@id': 'https://docs.tempo.xyz/#website' },
about: { '@id': 'https://tempo.xyz/#organization' },
publisher: { '@id': 'https://tempo.xyz/#organization' },
},
],
}
}
export function serializeJsonLd(schema: unknown) {
return JSON.stringify(schema)
.replace(/</g, '\\u003c')
.replace(/>/g, '\\u003e')
.replace(/&/g, '\\u0026')
}
export default function DocsJsonLd(props: { path?: string }) {
const { path } = useRouter()
const schema = createDocsJsonLdSchema({
path: props.path ?? path,
})
return (
<script
type="application/ld+json"
// biome-ignore lint/security/noDangerouslySetInnerHtml: JSON-LD requires innerHTML; content is escaped above.
dangerouslySetInnerHTML={{ __html: serializeJsonLd(schema) }}
/>
)
}