Repository navigation
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
203 lines (188 loc) · 6.62 KB
/
Copy pathdocusaurus.config.js
File metadata and controls
203 lines (188 loc) · 6.62 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
// @ts-check
// @see https://docusaurus.io/docs/api/docusaurus-config
import path from 'node:path';
import {darkCodeTheme, lightCodeTheme} from './src/codeThemes.js';
import referenceCounts from './src/referenceCounts.js';
import repositoryLinks from './src/remark/repositoryLinks.js';
// A build without 'RELEASE_VERSION' is not a release, so search engines
// skip it and it sends no analytics.
const isRelease = Boolean(process.env.RELEASE_VERSION);
const REPOSITORY_URL = 'https://github.com/drevops/behat-steps';
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Behat Steps',
tagline: 'A collection of Behat steps for PHP and Drupal projects',
favicon: 'img/favicon.png',
noIndex: !isRelease,
// 'DOCS_URL' and 'DOCS_BASE_URL' override the defaults, so a new host or
// path needs no change here.
url: process.env.DOCS_URL || 'https://behat-steps.drevops.com',
baseUrl: process.env.DOCS_BASE_URL || '/',
// GitHub Pages serves '<page>.html' at '/<page>', without the redirect that
// a '<page>/index.html' directory page needs.
trailingSlash: false,
organizationName: 'drevops',
projectName: 'behat-steps',
onBrokenLinks: 'throw',
onBrokenAnchors: 'throw',
// Pages and docs share the site root, so a doc slug can shadow a page.
onDuplicateRoutes: 'throw',
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
routeBasePath: '/',
sidebarPath: './sidebars.js',
path: 'content',
editUrl: `${REPOSITORY_URL}/edit/main/docs/`,
// Runs before Docusaurus resolves links, which would reject a link
// to a Markdown file outside the content directory.
beforeDefaultRemarkPlugins: [
[repositoryLinks, {
repositoryRoot: path.resolve(__dirname, '..'),
contentDir: path.resolve(__dirname, 'content'),
repositoryUrl: REPOSITORY_URL,
ref: process.env.RELEASE_VERSION || process.env.DOCS_REF || 'main',
}],
],
},
blog: false,
theme: {
customCss: './src/css/custom.css',
},
gtag: isRelease ? {trackingID: 'G-8EBLCFHHWR', anonymizeIP: true} : undefined,
}),
],
],
// Counts the steps of the generated pages and the helpers of HELPERS.md for
// the home page.
plugins: [[referenceCounts, {contentDir: path.resolve(__dirname, 'content'), helpersFile: path.resolve(__dirname, '..', 'HELPERS.md')}]],
markdown: {
// A '.md' page is CommonMark, so the generated references keep their raw
// HTML and render as they do on GitHub.
format: 'detect',
hooks: {
onBrokenMarkdownLinks: 'throw',
},
},
themes: [
[
'@easyops-cn/docusaurus-search-local',
/** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
({
// @see https://github.com/easyops-cn/docusaurus-search-local#theme-options
docsDir: 'content',
docsRouteBasePath: '/',
indexBlog: false,
hashed: true,
highlightSearchTermsOnTargetPage: true,
explicitSearchResultPath: true,
// The 'noindex' robots meta of a non-release build is meant for search
// engines, and would otherwise leave the site's own index empty.
forceIgnoreNoIndex: true,
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
image: 'img/social-card.jpg',
metadata: [
{name: 'keywords', content: 'behat, bdd, gherkin, mink, drupal, php, testing, step definitions'},
],
docs: {
sidebar: {
hideable: true,
autoCollapseCategories: true,
},
},
navbar: {
title: 'Behat Steps',
logo: {
src: 'img/logo.png',
},
items: [
{
type: 'docSidebar',
sidebarId: 'docs',
label: 'Docs',
position: 'left',
},
{
type: 'dropdown',
label: 'Steps',
position: 'left',
items: [
{to: '/web-steps', label: 'Web steps'},
{to: '/drupal-steps', label: 'Drupal steps'},
],
},
{
href: 'https://packagist.org/packages/drevops/behat-steps',
label: 'Packagist',
position: 'right',
title: 'View the package on Packagist',
},
{
href: REPOSITORY_URL,
label: 'GitHub',
position: 'right',
title: 'View source on GitHub',
},
{
type: 'search',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{label: 'Introduction', to: '/introduction'},
{label: 'Installation', to: '/installation'},
{label: 'Quick start', to: '/quick-start'},
{label: 'Web steps', to: '/web-steps'},
{label: 'Drupal steps', to: '/drupal-steps'},
],
},
{
title: 'Project',
items: [
{label: 'GitHub', href: REPOSITORY_URL},
{label: 'Releases', href: `${REPOSITORY_URL}/releases`},
{label: 'Issues', href: `${REPOSITORY_URL}/issues`},
{label: 'Packagist', href: 'https://packagist.org/packages/drevops/behat-steps'},
],
},
{
title: 'Community',
items: [
{label: 'Slack', href: 'https://drupal.slack.com/archives/C4T2JHG9K'},
{label: 'Vortex', href: 'https://www.vortextemplate.com'},
],
},
],
copyright: `Behat Steps version: ${process.env.RELEASE_VERSION || 'development'}<br/>Drupal is a <a class="footer__copyright-link" href="https://www.drupal.org/about/trademark">registered trademark</a> of <a class="footer__copyright-link" href="https://dri.es/">Dries Buytaert</a>.<br/>Copyright ©${new Date().getFullYear()} <a class="footer__copyright-link" href="https://www.drevops.com/">DrevOps®</a>. Built with <a class="footer__copyright-link" href="https://docusaurus.io/">Docusaurus</a>.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ['bash', 'gherkin', 'php'],
},
colorMode: {
defaultMode: 'light',
disableSwitch: false,
respectPrefersColorScheme: true,
},
}),
};
export default config;