forked from langfuse/langfuse-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththeme.config.tsx
199 lines (181 loc) · 5.42 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
import React from "react";
import {
DocsThemeConfig,
Tabs,
Tab,
useConfig,
Steps,
Card,
Cards,
} from "nextra-theme-docs";
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";
const config: DocsThemeConfig = {
logo: <Logo />,
main: MainContentWrapper,
search: {
placeholder: "Search...",
},
navbar: {
extraContent: (
<>
<a
className="p-1 hidden sm:inline-block hover:opacity-80"
target="_blank"
href="https://langfuse.com/discord"
aria-label="Langfuse Discord"
rel="nofollow noreferrer"
>
<IconDiscord className="h-7 w-7" />
</a>
<a
className="p-1 hidden sm: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: {
text: "Edit this page on GitHub",
},
toc: {
backToTop: true,
},
docsRepositoryBase: "https://github.com/langfuse/langfuse-docs/tree/main",
footer: {
text: <FooterMenu />,
},
useNextSeoProps() {
const { asPath } = useRouter();
const cookbook = COOKBOOK_ROUTE_MAPPING.find(
(cookbook) => cookbook.path === asPath
);
const canonical: string | undefined = cookbook?.canonicalPath
? "https://langfuse.com" + cookbook.canonicalPath
: undefined;
return {
titleTemplate:
asPath === "/"
? "Langfuse"
: asPath.startsWith("/blog/")
? "%s - Langfuse Blog"
: asPath.startsWith("/docs/guides/")
? "%s - Langfuse Guides"
: "%s - Langfuse",
canonical,
};
},
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"
: "";
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;
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"
/>
</>
);
},
components: {
Frame,
Tabs,
Tab,
Steps,
Card,
Cards,
},
// banner: {
// key: "golden-kitty-banner",
// dismissible: true,
// text: (
// <Link href="https://www.producthunt.com/golden-kitty-awards/hall-of-fame">
// {/* mobile */}
// <span className="sm:hidden">Langfuse won a Golden Kitty Award →</span>
// {/* desktop */}
// <span className="hidden sm:inline">
// Langfuse won a Golden Kitty Award in AI Infra →
// </span>
// </Link>
// ),
// },
};
export default config;