-
Notifications
You must be signed in to change notification settings - Fork 61
/
theme.config.tsx
213 lines (192 loc) · 6.21 KB
/
theme.config.tsx
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
import React from "react";
import { DocsThemeConfig, useConfig } from "nextra-theme-docs";
import { Cards, Steps, Tabs, Callout } from "nextra/components";
import { Logo } from "@/components/logo";
import { useRouter } from "next/router";
import { MainContentWrapper } from "./components/MainContentWrapper";
import { Frame } from "./components/Frame";
import { GithubMenuBadge } from "./components/GitHubBadge";
import { ToAppButton } from "./components/ToAppButton";
import { COOKBOOK_ROUTE_MAPPING } from "./lib/cookbook_route_mapping";
import { GeistSans } from "geist/font/sans";
import IconDiscord from "./components/icons/discord";
import FooterMenu from "./components/FooterMenu";
import Link from "next/link";
import { AvailabilityBanner } from "./components/availability";
import { CloudflareVideo, Video } from "./components/Video";
// import InkeepCustomTrigger from "./components/inkeep/InkeepCustomTrigger";
import InkeepSearchBar from "./components/inkeep/InkeepSearchBar";
const config: DocsThemeConfig = {
logo: <Logo />,
main: MainContentWrapper,
search: {
// placeholder: "Search...",
component: <InkeepSearchBar />,
},
navbar: {
extraContent: (
<>
<a
className="p-1 hidden lg:inline-block hover:opacity-80"
target="_blank"
href="https://discord.langfuse.com"
aria-label="Langfuse Discord"
>
<IconDiscord className="h-7 w-7" />
</a>
<a
className="p-1 hidden lg:inline-block hover:opacity-80"
target="_blank"
href="https://x.com/langfuse"
aria-label="Langfuse X formerly known as Twitter"
rel="nofollow noreferrer"
>
<svg
aria-label="X formerly known as Twitter"
fill="currentColor"
width="24"
height="24"
viewBox="0 0 24 22"
>
<path d="M16.99 0H20.298L13.071 8.26L21.573 19.5H14.916L9.702 12.683L3.736 19.5H0.426L8.156 10.665L0 0H6.826L11.539 6.231L16.99 0ZM15.829 17.52H17.662L5.83 1.876H3.863L15.829 17.52Z"></path>
</svg>
</a>
<GithubMenuBadge />
<ToAppButton />
</>
),
},
sidebar: {
defaultMenuCollapseLevel: 1,
toggleButton: true,
},
editLink: {
content: "Edit this page on GitHub",
},
toc: {
backToTop: true,
},
docsRepositoryBase: "https://github.com/langfuse/langfuse-docs/tree/main",
footer: {
content: <FooterMenu />,
},
head: () => {
const { asPath, defaultLocale, locale } = useRouter();
const { frontMatter, title: pageTitle } = useConfig();
const url =
"https://langfuse.com" +
(defaultLocale === locale ? asPath : `/${locale}${asPath}`);
const description = frontMatter.description ?? "";
const title = frontMatter.title ?? pageTitle;
const section = asPath.startsWith("/docs")
? "Docs"
: asPath.startsWith("/changelog/")
? "Changelog"
: asPath.startsWith("/cookbook/")
? "Cookbook"
: asPath.startsWith("/faq/")
? "FAQ"
: "";
const image = frontMatter.ogImage
? "https://langfuse.com" + frontMatter.ogImage
: `https://langfuse.com/api/og?title=${encodeURIComponent(
title
)}&description=${encodeURIComponent(
description
)}§ion=${encodeURIComponent(section)}`;
const video = frontMatter.ogVideo
? "https://langfuse.com" + frontMatter.ogVideo
: null;
const cookbook = COOKBOOK_ROUTE_MAPPING.find(
(cookbook) => cookbook.path === asPath
);
const canonical: string | undefined = cookbook?.canonicalPath
? "https://langfuse.com" + cookbook.canonicalPath
: undefined;
const noindex = frontMatter.noindex === true;
const titleTemplate =
asPath === "/"
? "Langfuse"
: asPath.startsWith("/blog/")
? "%s - Langfuse Blog"
: asPath.startsWith("/docs/guides/")
? "%s - Langfuse Guides"
: "%s - Langfuse";
return (
<>
<meta name="theme-color" content="#000" />
<meta property="og:url" content={url} />
<meta httpEquiv="Content-Language" content="en" />
<meta name="description" content={description} />
<meta property="og:description" content={description} />
{video && <meta property="og:video" content={video} />}
<meta property="og:image" content={image} />
<meta property="twitter:image" content={image} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site:domain" content="langfuse.com" />
<meta name="twitter:url" content="https://langfuse.com" />
<style
dangerouslySetInnerHTML={{
__html: `html { --font-geist-sans: ${GeistSans.style.fontFamily}; }`,
}}
/>
<link
rel="apple-touch-icon"
sizes="180x180"
href="/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/favicon-16x16.png"
/>
{canonical && <link rel="canonical" href={canonical} />}
{noindex && <meta name="robots" content="noindex" />}
<title>{titleTemplate.replace("%s", title)}</title>
</>
);
},
components: {
Frame,
Tabs,
Tab: ({
children,
...props
}: { children: React.ReactNode } & React.ComponentProps<
typeof Tabs.Tab
>) => (
<Tabs.Tab {...props} style={{ marginTop: "1rem" }}>
<div className="border rounded bg-background p-4">{children}</div>
</Tabs.Tab>
),
Steps,
Card: Cards.Card,
Cards,
AvailabilityBanner,
Callout,
CloudflareVideo,
Video,
},
banner: {
key: "v3-ga",
dismissible: true,
content: (
<Link href="/changelog/2024-12-09-Langfuse-v3-stable-release">
{/* mobile */}
<span className="sm:hidden">Langfuse v3 is GA. Learn more →</span>
{/* desktop */}
<span className="hidden sm:inline">
We've released Langfuse v3. Learn more →
</span>
</Link>
),
},
};
export default config;