-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocusaurus.config.ts
More file actions
230 lines (223 loc) · 6.51 KB
/
docusaurus.config.ts
File metadata and controls
230 lines (223 loc) · 6.51 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
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
import type * as Preset from "@docusaurus/preset-classic";
import type { Config } from "@docusaurus/types";
import { themes as prismThemes } from "prism-react-renderer";
const baseUrl = process.env.DOCUSAURUS_BASE_URL ?? "/docs/";
const LATEST_DEVVIT_VERSION = '0.12'; // update-versioned-docs.mjs sets this automatically
const config: Config = {
future: {
v4: true,
experimental_faster: true,
},
title: "Reddit for Developers",
tagline: "An app for anything",
url: "https://developers.reddit.com",
baseUrl,
onBrokenLinks: "warn",
favicon: "/img/devvit_icon.png",
markdown: {
format: "detect",
hooks: {
onBrokenMarkdownLinks: "throw",
},
},
headTags: [
// Added to headTags instead of scripts to keep the script and noscript tags together
// Start meta tag for Facebook Pixel DR-371
{
tagName: "script",
attributes: {},
innerHTML: `!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '4294970040755652');
fbq('track', 'PageView');`,
},
// End meta tag for Facebook Pixel
],
scripts: [
{
src: "https://widget.kapa.ai/kapa-widget.bundle.js",
"data-website-id": "7ea3e92e-b2a7-4159-a3ed-a7bcd1958ca5",
"data-project-name": "Reddit",
"data-modal-title": "Devvit AI Helper",
"data-project-color": "#FF4500",
"data-modal-disclaimer":
"This is an AI assistant with access to Devvit developer documentation and code examples. Please note that answers are generated by AI so remember to use your own judgment.",
"data-modal-example-questions":
"How do I make a game?,How can I earn money for my app?",
"data-project-logo": `${baseUrl}img/180x180.png`,
async: true,
},
{
src: `${baseUrl}events.js`,
},
],
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "reddit", // Usually your GitHub org/user name.
projectName: "reddit.github.io", // Usually your repo name.
trailingSlash: false,
// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en"],
},
presets: [
[
"@docusaurus/preset-classic",
{
docs: {
routeBasePath: "/", // Serve the docs at the site's root
sidebarPath: "./sidebars.ts",
lastVersion: LATEST_DEVVIT_VERSION,
versions: {
[LATEST_DEVVIT_VERSION]: {
badge: false,
},
"current": { // This refers to "/docs/next/"
noIndex: true,
},
"0.11": {
noIndex: true,
},
},
},
blog: {
path: "blog",
routeBasePath: "blog",
// Optional blog settings
postsPerPage: 10,
showReadingTime: true,
onInlineAuthors: "ignore",
onUntruncatedBlogPosts: "ignore",
},
sitemap: {
changefreq: "weekly",
priority: 0.5,
createSitemapItems: async (params) => {
const { defaultCreateSitemapItems, ...rest } = params;
const items = await defaultCreateSitemapItems(rest);
return items.filter((item) => {
if (!/next|\/\d+\.\d+\//.test(item.url)) {
return true;
} else {
// Too noisy!
// console.log("excluding", item.url);
return false;
}
});
},
},
theme: {
customCss: "./src/css/custom.css",
},
gtag: {
trackingID: "G-GWE79J8M6R",
anonymizeIP: true,
},
},
],
],
plugins: [
[
"@easyops-cn/docusaurus-search-local",
{
indexBlog: false,
docsRouteBasePath: "/",
ignoreFiles: [
/(?:^|\/)api(?:\/|$)/,
/(?:^|\/)icon$/,
/(?:^|\/)devvit_rules$/,
/(?:^|\/)migration_guide$/,
/(?:^|\/)three_strikes$/,
/(?:^|\/)playgrounds$/,
/(?:^|\/)playground$/,
],
},
],
[
"./plugins/llmsTxt.ts",
{
ignore: [
"**/api/**",
"**/blocks/**",
"**/changelog.md",
"**/icon.mdx",
"**/devvit_rules.md",
"**/migration_guide.md",
"**/three_strikes.md",
"**/playgrounds.mdx",
"**/playground.md",
],
},
],
"./plugins/copyDocsRaw.ts",
"./plugins/fixPrism.ts",
],
themeConfig: {
docs: {
sidebar: {
autoCollapseCategories: false,
},
},
navbar: {
logo: {
alt: "Reddit for Developers",
src: "img/logo.svg",
href: "https://developers.reddit.com/",
target: "_self",
},
items: [
{
docsPluginId: "default",
type: "docsVersionDropdown",
position: "left",
dropdownActiveClassDisabled: true,
},
],
},
footer: {
links: [
{
label: "Blog",
to: "/blog",
},
{
label: "The Reddit Developer Fund",
href: "https://support.reddithelp.com/hc/en-us/articles/27958169342996-Reddit-Developer-Funds-2025-Terms",
},
{
label: "r/Devvit",
href: "https://www.reddit.com/r/devvit",
},
{
label: "r/GamesOnReddit",
href: "https://www.reddit.com/r/GamesOnReddit",
},
{
label: "Join our Discord",
href: "https://developers.reddit.com/discord",
},
],
style: "dark",
copyright: `Reddit, Inc. © ${new Date().getFullYear()}. Built with Docusaurus.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
additionalLanguages: ["json", "bash"],
} satisfies Preset.ThemeConfig,
colorMode: {
disableSwitch: false,
respectPrefersColorScheme: true,
},
},
};
export default config;