Repository navigation
Expand file tree
/
Copy pathdocusaurus.config.ts
More file actions
230 lines (210 loc) · 7.26 KB
/
Copy pathdocusaurus.config.ts
File metadata and controls
230 lines (210 loc) · 7.26 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 { themes as prismThemes } from "prism-react-renderer";
import type { Config } from "@docusaurus/types";
import type * as Preset from "@docusaurus/preset-classic";
import * as dotenv from "dotenv";
import stripHeadingEmoji from "./src/plugins/strip-heading-emoji";
import lessonReadingTime from "./src/plugins/lesson-reading-time";
dotenv.config({ path: ".env.local" });
dotenv.config();
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
const algoliaAppId = process.env.ALGOLIA_APP_ID?.trim();
const algoliaSearchApiKey = process.env.ALGOLIA_SEARCH_API_KEY?.trim();
const algoliaIndexName = process.env.ALGOLIA_INDEX_NAME?.trim();
const hasAlgoliaSiteSearch = Boolean(
algoliaAppId && algoliaSearchApiKey && algoliaIndexName,
);
const hasPartialAlgoliaSiteSearchConfig = Boolean(
algoliaAppId || algoliaSearchApiKey || algoliaIndexName,
);
if (hasPartialAlgoliaSiteSearchConfig && !hasAlgoliaSiteSearch) {
console.warn(
"Algolia SiteSearch is partially configured. Set ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY, and the actual Algolia index name in ALGOLIA_INDEX_NAME to enable navbar search.",
);
}
const config: Config = {
title: "recode hive",
tagline: "Learn, Build & Grow with Open Source",
favicon: "img/favicon.ico",
url: "https://www.recodehive.com",
baseUrl: "/",
organizationName: "recodehive",
projectName: "recode-website",
onBrokenLinks: "throw",
onBrokenAnchors: "ignore",
// onBrokenMarkdownLinks moved to markdown.hooks
// Google Analytics and Theme Scripts
scripts: [
{
src: "/instant-theme.js",
async: false,
},
{
src: "https://www.googletagmanager.com/gtag/js?id=G-W02Z2VJYCR",
async: true,
},
{
src: "/gtag-init.js",
},
{
src: "/pinterest-init.js",
},
],
stylesheets: [
{
href: "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;700&family=JetBrains+Mono:wght@400;500&display=swap",
type: "text/css",
},
],
i18n: {
defaultLocale: "en",
locales: ["en"],
},
presets: [
[
"classic",
{
docs: {
path: "docs",
routeBasePath: "docs",
sidebarPath: require.resolve("./sidebars.ts"),
// Lessons only: gives <LessonHeader> the word count of its page, so the reading time is computed
remarkPlugins: [lessonReadingTime],
editUrl: ({ docPath }) =>
`https://github.com/recodehive/recode-website/tree/main/docs/${docPath}`,
},
blog: {
showReadingTime: true,
// Blog only: no emoji at the start of headings, so the contents list stays clean
remarkPlugins: [stripHeadingEmoji],
feedOptions: {
type: ["rss", "atom"],
xslt: true,
},
// Each post links to its own source file, for example blog/<slug>/index.md
editUrl: ({ blogDirPath, blogPath }: { blogDirPath: string; blogPath: string }) =>
`https://github.com/recodehive/recode-website/tree/main/${blogDirPath}/${blogPath}`,
onInlineTags: "warn",
onInlineAuthors: "warn",
onUntruncatedBlogPosts: "warn",
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
gtag: {
trackingID: "G-W02Z2VJYCR",
anonymizeIP: false,
},
} satisfies Preset.Options,
],
],
themeConfig: {
image: "/img/og-image.png",
colorMode: {
defaultMode: "light",
disableSwitch: false,
respectPrefersColorScheme: false, // Let users manually control theme
},
navbar: {
title: "recode hive",
logo: {
alt: "recode hive Logo",
src: "img/logo.png",
srcDark: "img/logo-dark.png", // add: light-colored / white-background version for night mode
},
// The menu is rendered by src/components/navbar (content in src/data/navbar.ts)
items: [],
},
footer: {
style: "dark",
links: [],
copyright: `Copyright © ${new Date().getFullYear()} recode hive. Built with Docusaurus.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
blog: {
sidebar: {
groupByYear: false,
},
},
} satisfies Preset.ThemeConfig,
markdown: {
mermaid: true,
},
// Migrated legacy setting to markdown.hooks.onBrokenMarkdownLinks
themes: ["@docusaurus/theme-mermaid"],
plugins: [
// The blog guide moved from /docs/Getting-Started, so old links keep working
[
"@docusaurus/plugin-client-redirects",
{ redirects: [{ from: "/docs/Getting-Started", to: "/docs/how-to-contribute-to-blogs" }] },
],
// Free Learn section: one MDX file per lesson, each with its own URL
[
"@docusaurus/plugin-content-docs",
{
id: "learn",
path: "learn",
routeBasePath: "learn",
docRootComponent: "@site/src/learn/LearnRoot",
docItemComponent: "@site/src/learn/LearnDoc",
},
],
// Counts lesson words at build time; thin lessons get noindex
"./plugins/learn-words",
// Publish dates for the Broadcasts page from YouTube public RSS feeds (no API key)
"./plugins/broadcasts-feed",
// Exposes every blog post to the /blogs listing page
"./plugins/blog-listing",
// Real GitHub Discussions, fetched at build time (token never reaches the browser)
"./plugins/github-discussions",
// Dashboard notifications, read from src/data/notifications.txt
"./plugins/notifications",
// One static public profile page per contributor at /u/<handle>
"./plugins/developer-profiles",
// Star and fork counts for the first-time setup guide (hidden if GitHub is unreachable)
"./plugins/repo-stats",
[
"@docusaurus/plugin-ideal-image",
{
quality: 70,
max: 1030,
min: 640,
steps: 2,
disableInDev: true,
},
],
],
// Custom fields exposed to client-side code (browser-visible at build time)
customFields: {
backendApiUrl: process.env.BACKEND_API_URL || "https://leaderboard-production-6143.up.railway.app",
clerkPublishableKey: process.env.VITE_CLERK_PUBLISHABLE_KEY || "",
// Giveaway backend (public values). The anon key only reads the public ledger views.
// Reserved ad containers on blog posts stay empty and hidden until this is true
adsEnabled: false,
supabaseUrl: process.env.SUPABASE_URL || "",
supabaseAnonKey: process.env.SUPABASE_ANON_KEY || "",
// Shopify credentials for merch store
SHOPIFY_STORE_DOMAIN:
process.env.SHOPIFY_STORE_DOMAIN || "junh9v-gw.myshopify.com",
SHOPIFY_STOREFRONT_ACCESS_TOKEN:
process.env.SHOPIFY_STOREFRONT_ACCESS_TOKEN ||
"2503dfbf93132b42e627e7d53b3ba3e9",
// EmailJS credentials for Contact Us page (public values only)
EMAILJS_PUBLIC_KEY: process.env.EMAILJS_PUBLIC_KEY || "",
EMAILJS_SERVICE_ID: process.env.EMAILJS_SERVICE_ID || "",
EMAILJS_TEMPLATE_ID: process.env.EMAILJS_TEMPLATE_ID || "",
algoliaSiteSearch: hasAlgoliaSiteSearch
? {
applicationId: algoliaAppId,
apiKey: algoliaSearchApiKey,
indexName: algoliaIndexName,
}
: null,
hooks: {
onBrokenMarkdownLinks: "warn",
},
},
};
export default config;