-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
221 lines (197 loc) · 6.12 KB
/
docusaurus.config.js
File metadata and controls
221 lines (197 loc) · 6.12 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
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const { themes } = require('prism-react-renderer');
const lightCodeTheme = themes.nightOwlLight;
const darkCodeTheme = themes.nightOwl;
const defaultUrl = 'https://docs.overturemaps.org';
const defaultBaseUrl = '/';
// SCHEMA_PREVIEW is set by the schema repo's CI when building a PR preview of the
// schema reference docs (see OvertureMaps/schema/.github/workflows/schema-pr-preview.yml).
// When true, only the schema reference section is built — blog, community pages, and
// navbar items unrelated to the schema are excluded to keep the preview fast and focused.
const isSchemaPreview = process.env.SCHEMA_PREVIEW === 'true';
function getFromEnvironment(variableName, defaultValue) {
const environmentValue = process.env[variableName];
return environmentValue ? environmentValue : defaultValue;
}
function getLatestOvertureRelease() {
const fallback = '2026-04-15.0';
try {
const { execSync } = require('child_process');
const response = execSync('curl -s https://stac.overturemaps.org/catalog.json', {
encoding: 'utf-8',
timeout: 10000,
});
const catalog = JSON.parse(response);
return catalog.latest || fallback;
} catch (error) {
console.warn(error);
console.warn('Failed to fetch latest Overture release, using fallback:', fallback);
return fallback;
}
}
const latestOvertureRelease = getLatestOvertureRelease();
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Overture Maps Documentation',
tagline: '',
favicon: 'img/favicon.png',
customFields: {
overtureRelease: latestOvertureRelease,
pmtiles_path: 'https://tiles.overturemaps.org/' + latestOvertureRelease,
},
future: {
v4: true,
faster: {
swcJsLoader: true,
swcJsMinimizer: true,
swcHtmlMinimizer: true,
lightningCssMinimizer: true,
rspackBundler: true,
},
},
// Set the production url of your site here
url: getFromEnvironment('DOCUSAURUS_URL', defaultUrl),
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: getFromEnvironment('DOCUSAURUS_BASE_URL', defaultBaseUrl),
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'OvertureMaps', // Usually your GitHub org/user name.
projectName: 'docs', // Usually your repo name.
onBrokenLinks: 'throw',
onBrokenAnchors: 'throw',
onDuplicateRoutes: 'throw',
markdown: {
hooks: {
onBrokenMarkdownLinks: 'throw',
},
mdx1Compat: {
comments: true,
admonitions: true,
headingIds: true,
},
},
trailingSlash: true,
// 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'],
},
themes: [],
plugins: isSchemaPreview
? []
: [
[
'@docusaurus/plugin-content-pages',
{
id: 'community',
path: './community',
routeBasePath: 'community',
showLastUpdateTime: true,
},
],
],
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
routeBasePath: '/',
showLastUpdateTime: true,
breadcrumbs: false,
},
blog: isSchemaPreview
? false
: {
blogTitle: 'Overture Maps Engineering Blog',
blogDescription: 'Building Overture Maps',
blogSidebarTitle: 'Posts from the Overture Maps engineering team',
blogSidebarCount: 20,
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
gtag:
process.env.DOCUSAURUS_URL === defaultUrl
? {
trackingID: 'G-JBXK7VCHV4',
anonymizeIP: true,
}
: false,
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
docs: {
sidebar: {
hideable: true,
},
},
image: 'img/omf_logo_transparent.png',
navbar: {
title: 'Overture Maps',
logo: {
alt: 'Overture Maps Foundation Logo',
src: 'img/omf_logo_transparent.png',
href: 'https://overturemaps.org',
},
items: [
{
to: '/',
position: 'left',
label: 'Docs',
},
...(!isSchemaPreview
? [
{
to: 'blog',
label: 'Blog',
position: 'left',
},
{
to: 'community',
label: 'Community',
position: 'left',
},
]
: []),
{
to: 'https://github.com/OvertureMaps/docs',
position: 'right',
target: '_blank',
className: 'github-link',
},
],
},
algolia: {
appId: 'MK8X1051PQ',
//this is the public search API key; ok to commit
apiKey: '29fe3f5bc0dabfade01c016695919c8d',
indexName: 'overturemaps',
contextualSearch: true,
// Optional: Algolia search parameters
searchParameters: {},
// Optional: path for search page that enabled by default (`false` to disable it)
searchPagePath: 'search',
// Optional: whether the insights feature is enabled or not on Docsearch (`false` by default)
insights: false,
},
footer: {
style: 'dark',
copyright: `Copyright © ${new Date().getFullYear()} Overture Maps Foundation.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ['bash', 'diff', 'json', 'sql', 'python'],
},
}),
};
module.exports = config;