-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
239 lines (213 loc) · 9.53 KB
/
Copy pathdocusaurus.config.js
File metadata and controls
239 lines (213 loc) · 9.53 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
231
232
233
234
235
236
237
238
239
// @ts-check
// `@type` JSDoc annotations allow editor autocompletion and type checking
// (when paired with `@ts-check`).
// There are various equivalent ways to declare your Docusaurus config.
// See: https://docusaurus.io/docs/api/docusaurus-config
import { themes as prismThemes } from 'prism-react-renderer';
import { execSync } from 'node:child_process';
// Run git to get versions, and commit date when buildingg.
// Fall-back to defaulst for non-git clones/tarballs/plain dir upload
function vcs_info() {
const run = (cmd) => execSync(cmd, { encoding: 'utf8' }).trim();
try {
return {
version: run('git describe --always --tags --dirty'),
commit_date: run('git log -1 --format=%cI'),
// also strip trailing slash
repo_url: run('git config --get remote.origin.url').replace(/\/$/, ''),
};
} catch {
return {
version: 'unknown',
commit_date: '',
repo_url: 'https://github.com/aboutcode-org/www.aboutcode.org',
};
}
}
// Deployment target: local | gh | dreamhost
/** @type {'local' | 'gh' | 'dreamhost'} */
let deployTarget = 'local';
if (process.env.DEPLOY_TARGET === 'gh') {
deployTarget = 'gh';
} else if (process.env.DEPLOY_TARGET === 'dreamhost') {
deployTarget = 'dreamhost';
}
const siteConfig = {
local: {
url: 'http://localhost',
baseUrl: '/',
},
gh: {
url: 'https://aboutcode-org.github.io',
baseUrl: '/www.aboutcode.org/',
},
dreamhost: {
// url: 'https://www.aboutcode.org',
url: 'https://aboutcode.org',
baseUrl: '/',
},
};
// Define const for the footer icon paths.
const currentBaseUrl = siteConfig[deployTarget].baseUrl
const vcs = vcs_info();
const buildLine = vcs.version === 'unknown'
? ''
: `<div class="footer__build">Built with Docusaurus from <a href="${vcs.repo_url}" target="_blank" rel="noopener noreferrer">${vcs.repo_url} @ ${vcs.version}</a> on ${vcs.commit_date}</div>`;
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'AboutCode.org',
tagline: 'Open data, tools, and standards for the software supply chains',
favicon: 'img/favicon.ico',
markdown: {
format: 'detect', // Auto-detects: .md = plain Markdown (CommonMark), .mdx = MDX
hooks: {
onBrokenMarkdownLinks: 'warn', // This new setting surfaced in 3.9.
},
},
// Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
future: {
v4: true, // Improve compatibility with the upcoming Docusaurus v4
},
// Adapt the www.packageurl.org approach for the GH Pages vs. DreamHost baseUrl adjustment.
url: siteConfig[deployTarget].url,
baseUrl: siteConfig[deployTarget].baseUrl,
trailingSlash: true,
onBrokenLinks: 'throw',
// The following is deprecated, to be removed in v4, replaced with similar structure above under 'markdown:'.
// (New config was introduced in 3.9 -- https://docusaurus.io/blog/releases/3.9#:~:text=In%20%2311283%2C%20we%20added%20siteConfig,to%20make%20Docusaurus%20build%20faster.)
// onBrokenMarkdownLinks: 'warn',
// Even if you don't use internationalization, 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: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
// sidebarPath: './sidebars.js',
// 2026-05-05 15:57:26 (PT) Tuesday. Does this address the link errors?
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
// editUrl:
// 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
editUrl: ({ docPath }) => {
// TODO We can include a map here as in packageurl.org.
// Otherwise, provide a default (so “Edit this page” still works)
return `https://github.com/aboutcode-org/www.aboutcode.org/blob/main/website/docs/${docPath}`;
},
},
blog: {
showReadingTime: true,
blogSidebarTitle: 'All posts',
blogSidebarCount: 'ALL',
blogTitle: 'AboutCode blog!',
editUrl: 'https://github.com/aboutcode-org/www.aboutcode.org/tree/main/website/',
},
theme: {
customCss: './src/css/custom.css',
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// colorMode: {
// respectPrefersColorScheme: true,
// },
navbar: {
logo: {
alt: 'www.aboutcode.org Logo',
src: 'img/AboutCode.svg',
},
style: 'dark',
items: [
{
type: 'docSidebar',
sidebarId: 'getting_started',
position: 'left',
label: 'Getting Started',
},
{ to: '/blog',
label: 'Blog',
position: 'left'
},
{ to: '/projects',
label: 'Projects',
position: 'left'
},
{ to: '/environments',
label: 'Environments',
position: 'left'
},
{
type: 'dropdown',
label: 'About',
position: 'left',
items: [
{ to: '/docs/about/contribute', label: 'Contribute' },
{ to: '/docs/about/events', label: 'Events' },
{ to: '/docs/about/meetings', label: 'Meetings' },
{ to: '/docs/about/news', label: 'News' },
{ to: '/docs/about/releases', label: 'Releases' },
{ to: '/docs/about/standards', label: 'Standards' },
{ to: '/docs/about/credits', label: 'Thank you' },
],
},
{
href: 'https://aboutcode.readthedocs.io',
label: 'Doc',
position: 'right',
},
{
href: 'https://join.slack.com/t/aboutcode-org/shared_invite/zt-31uzazd7l-tBHcqKUKkX6jUEPRLswiNw',
label: 'Slack',
position: 'right',
},
{
href: 'https://github.com/aboutcode-org',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
html: `<img src="${currentBaseUrl}img/AboutCode.svg" alt="AboutCode.org" width="150"/>`,
},
{
html: `<a href="https://github.com/aboutcode-org" target="_blank" rel="noopener noreferrer" aria-label="GitHub"><img src="${currentBaseUrl}img/github-mark-white.svg" alt="" width="20" height="20"></a>`,
},
{
html: `<a href="https://www.linkedin.com/company/aboutcode/" target="_blank" rel="noopener noreferrer" aria-label="LinkedIn"><img src="${currentBaseUrl}img/brand-inlogo-download-fg-dsk-v01-2x.png" alt="" width="20" height="20"></a>`,
},
{
html: `<a href="https://join.slack.com/t/aboutcode-org/shared_invite/zt-31uzazd7l-tBHcqKUKkX6jUEPRLswiNw" target="_blank" rel="noopener noreferrer" aria-label="Slack"><img src="${currentBaseUrl}img/slack-logo.svg" alt="" width="20" height="20"></a>`,
},
{
html: `<a href="https://app.gitter.im/#/room/#aboutcode-org_discuss:gitter.im" target="_blank" rel="noopener noreferrer" aria-label="Gitter"><img src="${currentBaseUrl}img/gitter.svg" alt="" width="20" height="20"></a>`,
},
{
html: `<a href="mailto:hello@aboutcode.org" target="_blank" rel="noopener noreferrer" aria-label="Email"><img src="${currentBaseUrl}img/email-svgrepo-com.svg" alt="" width="25" height="20"></a>`,
},
{ label: 'Privacy Policy', to: '/privacy' },
{ label: 'Terms of Use', to: '/terms' },
{ label: 'Credits', to: '/docs/about/credits' },
],
copyright: `Copyright (c) AboutCode Europe ASBL. Content licensed under CC-BY-SA-4.0.${buildLine}`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
}),
};
export default config;