Repository navigation
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
228 lines (212 loc) · 7.17 KB
/
Copy pathdocusaurus.config.js
File metadata and controls
228 lines (212 loc) · 7.17 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
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const prism = require("prism-react-renderer");
const path = require("path");
const fs = require("fs");
const getCurrentVersion = () => {
// The file is created when "docusaurus docs:version <version>" is executed.
const versionsPath = path.resolve(__dirname, "versions.json");
if (fs.existsSync(versionsPath)) {
return require(versionsPath)[0];
} else {
console.warn('The documentation is not versioned. Run "docusaurus docs:version <current version>"');
return "<OPENLINEAGE VERSION>";
}
};
// Get only the most recent versions to build (limit to reduce memory usage)
const getVersionsToBuild = () => {
const versionsPath = path.resolve(__dirname, "versions.json");
if (!fs.existsSync(versionsPath)) {
return ["current"];
}
const allVersions = require(versionsPath);
// Build only the 10 most recent versions (plus "current")
const MAX_VERSIONS_TO_BUILD = 10;
const versionsToBuild = allVersions.slice(0, Math.min(MAX_VERSIONS_TO_BUILD, allVersions.length));
return ["current", ...versionsToBuild];
};
// Replaces every occurrence of "{{PREPROCESSOR:OPENLINEAGE_VERSION}}" with the current version of the documentation.
const openLineageVersionProvider = ({ filePath, fileContent }) => {
return fileContent.replace(/{{PREPROCESSOR:OPENLINEAGE_VERSION}}/g, getCurrentVersion());
};
const links = [
{ to: "/getting-started", label: "Getting Started", position: "left" },
{ to: "/resources", label: "Resources", position: "left" },
{ to: "/ecosystem", label: "Ecosystem", position: "left" },
{ to: "/community", label: "Community", position: "left" },
{ to: "/blog", label: "Blog", position: "left" },
{ to: "/docs", label: "Docs", position: "left" },
];
const linksSocial = [
{ href: "https://fosstodon.org/@openlineage", label: "Mastodon", rel: "me" },
{ href: "https://twitter.com/OpenLineage", label: "Twitter" },
{ href: "https://www.linkedin.com/groups/13927795/", label: "LinkedIn" },
{ href: "https://join.slack.com/t/openlineage/shared_invite/zt-3arpql6lg-Nt~hicnDsnDY_GK_LEX06w", label: "Slack" },
{ href: "https://github.com/OpenLineage/OpenLineage", label: "GitHub" },
];
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "OpenLineage",
tagline: "OpenLineage",
url: "https://openlineage.io",
baseUrl: "/",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "throw",
favicon: "img/favicon.ico",
customFields: {
links: links,
linksSocial: linksSocial,
},
organizationName: "openlineage",
projectName: "docs",
i18n: {
defaultLocale: "en",
locales: ["en"],
},
presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve("./sidebars.js"),
exclude: ["**/partials/**"],
// Only build the 10 most recent versions to reduce memory usage
onlyIncludeVersions: getVersionsToBuild(),
editUrl: ({ versionDocsDirPath, docPath, version }) => {
if (version === "current") {
return `https://github.com/OpenLineage/OpenLineage/tree/main/website/docs/${docPath}`;
} else {
return `https://github.com/OpenLineage/openlineage-site/tree/main/${versionDocsDirPath}/${docPath}`;
}
},
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
blog: {
blogTitle: "Blog",
blogDescription:
"Data lineage is the foundation for a new generation of powerful, context-aware data tools and best practices. OpenLineage enables consistent collection of lineage metadata, creating a deeper understanding of how data is produced and used.",
showReadingTime: true,
blogSidebarCount: 5,
blogSidebarTitle: "Recent posts",
feedOptions: {
type: ["json"],
copyright: `Copyright © ${new Date().getFullYear()} The Linux Foundation®. All rights reserved.`,
},
},
pages: {
path: "src/pages",
include: ["**/*.{js,jsx,ts,tsx,md,mdx}"],
exclude: [
"home.tsx", // this page served from plugin
"**/_*.{js,jsx,ts,tsx,md,mdx}",
"**/_*.{js,jsx,ts,tsx,md,mdx}",
"**/_*/**",
"**/*.test.{js,jsx,ts,tsx}",
"**/__tests__/**",
],
mdxPageComponent: "@theme/MDXPage",
},
gtag: {
trackingID: "G-QMTWMLMX4M",
anonymizeIP: true,
},
}),
],
],
plugins: [
function tailwindcssPlugin(ctx, options) {
return {
name: "docusaurus-tailwindcss",
configurePostCss(postcssOptions) {
// Appends TailwindCSS and AutoPrefixer.
postcssOptions.plugins.push(require("tailwindcss"));
postcssOptions.plugins.push(require("autoprefixer"));
return postcssOptions;
},
};
},
[
"./plugins/home-blog-plugin",
{
id: "blogs",
routeBasePath: "/",
path: "./blogs",
},
],
[
"@docusaurus/plugin-client-redirects",
{
// Link the integrations and Flink category URLs with their about.md, in whichever direction
// exists: docs with the `slug` front matter redirect .../about to the category URL, older
// versioned snapshots without it redirect the category URL to .../about.
/** @param {string} existingPath */
createRedirects(existingPath) {
const category = existingPath.match(/^(.*\/integrations(?:\/flink)?)\/?$/);
if (category) {
return [`${category[1]}/about`];
}
const about = existingPath.match(/^(.*\/integrations(?:\/flink)?)\/about\/?$/);
return about ? [about[1]] : undefined;
},
},
],
[
"docusaurus-lunr-search",
{
disableVersioning: false,
excludeRoutes: ["**/next/**", "docs/+([0-9]).+([0-9]).+([0-9])/**"],
},
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
logo: {
alt: "OpenLineage",
src: "img/ol-logo.svg",
},
items: [
...links,
{
href: "https://join.slack.com/t/openlineage/shared_invite/zt-3arpql6lg-Nt~hicnDsnDY_GK_LEX06w",
label: "Slack",
position: "right",
},
{
href: "https://github.com/OpenLineage/openlineage",
label: "GitHub",
position: "right",
},
],
},
prism: {
theme: prism.themes.github,
darkTheme: prism.themes.dracula,
additionalLanguages: ["java"],
},
colorMode: {
defaultMode: "light",
disableSwitch: false,
respectPrefersColorScheme: false,
},
image: "img/home-thumb.png",
}),
scripts: [
{
src: "/js/gtag-fallback.js",
},
{
src: "https://plausible.io/js/script.js",
defer: true,
"data-domain": "openlineage.io",
},
],
markdown: {
preprocessor: openLineageVersionProvider,
},
};
module.exports = config;