-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdocusaurus.config.js
201 lines (186 loc) · 5.75 KB
/
docusaurus.config.js
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
const path = require("path");
const math = require("remark-math");
const katex = require("rehype-katex");
const { versions, versionedPages, versionedCategories } = require("./dbt-athena-versions");
require("dotenv").config();
/* Debugging */
let SITE_URL;
if (!process.env.CONTEXT || process.env.CONTEXT == "production") {
SITE_URL = "https://dbt-athena.github.io";
} else {
SITE_URL = process.env.DEPLOY_URL;
}
let GIT_BRANCH;
if (!process.env.CONTEXT || process.env.CONTEXT == "production") {
GIT_BRANCH = "main";
} else {
GIT_BRANCH = process.env.HEAD;
}
let { ALGOLIA_APP_ID, ALGOLIA_API_KEY, ALGOLIA_INDEX_NAME } = process.env;
let metatags = [];
// If Not "main" Branch, do not index site
if (GIT_BRANCH !== "main") {
metatags.push({
tagName: "meta",
attributes: {
name: "robots",
content: "noindex",
},
});
}
console.log("DEBUG: CONTEXT =", process.env.CONTEXT);
console.log("DEBUG: DEPLOY_URL =", process.env.DEPLOY_URL);
console.log("DEBUG: SITE_URL = ", SITE_URL);
console.log("DEBUG: ALGOLIA_INDEX_NAME = ", ALGOLIA_INDEX_NAME);
console.log("DEBUG: metatags = ", metatags);
console.log("DEBUG: PREVIEW_PATH = ", process.env.PREVIEW_PATH);
// Preview PR urls need a different base URL
const baseUrl = process.env.PREVIEW_PATH ? process.env.PREVIEW_PATH : "/";
var siteSettings = {
baseUrl,
tagline: "Documentation for dbt-athena",
title: "dbt-athena docs",
url: SITE_URL,
favicon: "img/favicon.svg",
// GitHub pages deployment config.
organizationName: "dbt-athena",
projectName: "docs.getdbt.com",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "throw",
trailingSlash: false,
themeConfig: {
docs: {
sidebar: {
hideable: true,
},
},
image: "/img/avatar.png",
colorMode: {
defaultMode: "light",
disableSwitch: false,
respectPrefersColorScheme: true,
},
// Adding non-empty strings for Algolia config
// allows Docusaurus to run locally without .env file
algolia: {
apiKey: ALGOLIA_API_KEY ? ALGOLIA_API_KEY : "dbt",
indexName: ALGOLIA_INDEX_NAME ? ALGOLIA_INDEX_NAME : "dbt",
appId: ALGOLIA_APP_ID ? ALGOLIA_APP_ID : "dbt",
//debug: true,
},
prism: {
theme: (() => {
var theme = require("prism-react-renderer/themes/nightOwl");
// Add additional rule to nightowl theme in order to change
// the color of YAML keys (to be different than values).
// There weren't many Prism themes that differentiated
// YAML keys and values. See link:
// https://github.com/FormidableLabs/prism-react-renderer/tree/master/src/themes
theme.styles.push({
types: ["atrule"],
style: {
// color chosen from the nightowl theme palette
// https://github.com/FormidableLabs/prism-react-renderer/blob/master/src/themes/nightOwl.js#L83
color: "rgb(255, 203, 139)",
},
});
return theme;
})(),
additionalLanguages: ["bash"],
},
navbar: {
hideOnScroll: true,
logo: {
src: "/img/dbt-athena-logo.svg",
srcDark: "img/dbt-athena-logo-dark.svg",
alt: "dbt-athena Logo",
},
items: [
{
to: "/",
label: "Docs",
position: "left",
activeBaseRegex: "docs/(?!(dbt-cloud))",
},
],
},
footer: {
links: [
{
html: `
<div class='footer__items'>
</div>
<div class='footer__items--right'>
<a href='https://www.getdbt.com/community/join-the-community/'><i class="fa-brands fa-slack"></i></a>
<a href='https://github.com/dbt-athena/dbt-athena'><i class="fa-brands fa-github"></i></a>
</div>
`,
},
],
copyright: `© ${new Date().getFullYear()} dbt-athena.`,
},
},
presets: [
[
"@docusaurus/preset-classic",
{
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
docs: {
path: "docs",
routeBasePath: "/",
sidebarPath: require.resolve("./sidebars.js"),
remarkPlugins: [math],
rehypePlugins: [katex],
editUrl: "https://github.com/dbt-athena/dbt-athena.github.io/edit/" + GIT_BRANCH,
showLastUpdateTime: true,
//showLastUpdateAuthor: false,
sidebarCollapsible: true,
},
blog: false,
},
],
],
plugins: [
[path.resolve("plugins/insertMetaTags"), { metatags }],
path.resolve("plugins/svg"),
path.resolve("plugins/customWebpackConfig"),
[path.resolve("plugins/buildGlobalData"), { versionedPages, versionedCategories }],
],
scripts: ["https://kit.fontawesome.com/7110474d41.js"],
stylesheets: [
`${baseUrl}css/fonts.css`,
`${baseUrl}css/entypo.css`,
`${baseUrl}css/search.css`,
`${baseUrl}css/api.css`,
"https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;500;600;700&display=swap",
"https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;500;600;700&display=swap",
{
href: "https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css",
type: "text/css",
integrity: "sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM",
crossorigin: "anonymous",
},
],
};
// If versions json file found, add versions dropdown to nav
if (versions) {
siteSettings.themeConfig.navbar.items.push({
label: "Versions",
position: "left",
className: "nav-versioning",
items: [
...versions.reduce((acc, version) => {
if (version?.version) {
acc.push({
label: `${version.version}`,
href: "#",
});
}
return acc;
}, []),
],
});
}
module.exports = siteSettings;