|
1 |
| -import {themes as prismThemes} from 'prism-react-renderer'; |
2 |
| -import type {Config} from '@docusaurus/types'; |
| 1 | +import { themes as prismThemes } from 'prism-react-renderer'; |
| 2 | +import type { Config } from '@docusaurus/types'; |
3 | 3 | import type * as Preset from '@docusaurus/preset-classic';
|
4 | 4 |
|
| 5 | +// Settings related to what we've set up for GitHub Pages and Netlify. |
| 6 | +const githubOrg = 'validator-labs'; |
| 7 | +const githubRepo = 'docs'; |
| 8 | +const netlifySiteName = 'validator-labs-docs'; |
| 9 | + |
| 10 | +// Whether the site is being deployed to Netlify. This affects parts of the config so that the site |
| 11 | +// is deployed corectly to each. |
| 12 | +const deployingToNetlify = process.env['DEPLOYING_TO_NETLIFY'] === 'TRUE' || false; |
| 13 | + |
5 | 14 | const config: Config = {
|
6 | 15 | title: 'Validator Documentation',
|
7 | 16 | tagline: 'Validate all the things',
|
8 | 17 | favicon: 'img/favicon.ico',
|
9 | 18 |
|
10 | 19 | // Set the production url of your site here
|
11 |
| - url: 'https://validator-labs.github.io/', |
| 20 | + url: deployingToNetlify ? `https://${netlifySiteName}.netlify.app` : `https://${githubOrg}.github.io/`, |
12 | 21 | // Set the /<baseUrl>/ pathname under which your site is served
|
13 | 22 | // For GitHub pages deployment, it is often '/<projectName>/'
|
14 |
| - baseUrl: '/docs', |
| 23 | + baseUrl: deployingToNetlify ? `/` : `/${githubRepo}`, |
15 | 24 |
|
16 | 25 | // GitHub pages deployment config.
|
17 | 26 | // If you aren't using GitHub pages, you don't need these.
|
18 |
| - organizationName: 'validator-labs', // Usually your GitHub org/user name. |
19 |
| - projectName: 'docs', // Usually your repo name. |
| 27 | + organizationName: githubOrg, // Usually your GitHub org/user name. |
| 28 | + projectName: githubRepo, // Usually your repo name. |
20 | 29 | trailingSlash: false,
|
21 | 30 |
|
| 31 | + // If we're deploying to Netlify, we don't want search engines to index us. This lets us use some |
| 32 | + // other deployment destination for production. In this case, that's GitHub Pages. |
| 33 | + noIndex: deployingToNetlify, |
| 34 | + |
22 | 35 | onBrokenLinks: 'throw',
|
23 |
| - onBrokenMarkdownLinks: 'warn', |
| 36 | + onBrokenAnchors: 'throw', |
| 37 | + onBrokenMarkdownLinks: 'throw', |
24 | 38 |
|
25 | 39 | // Even if you don't use internationalization, you can use this field to set
|
26 | 40 | // useful metadata like html lang. For example, if your site is Chinese, you
|
@@ -81,7 +95,7 @@ const config: Config = {
|
81 | 95 | position: 'left',
|
82 | 96 | label: 'Tutorial',
|
83 | 97 | },
|
84 |
| - {to: '/blog', label: 'Blog', position: 'left'}, |
| 98 | + { to: '/blog', label: 'Blog', position: 'left' }, |
85 | 99 | {
|
86 | 100 | href: 'https://github.com/facebook/docusaurus',
|
87 | 101 | label: 'GitHub',
|
|
0 commit comments