Skip to content

Commit 2cfcac8

Browse files
committed
Settings for GHP and Netlify
Signed-off-by: Matt Welke <matt.welke@spectrocloud.com>
1 parent 8ef3c15 commit 2cfcac8

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

docusaurus.config.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,40 @@
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';
33
import type * as Preset from '@docusaurus/preset-classic';
44

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+
514
const config: Config = {
615
title: 'Validator Documentation',
716
tagline: 'Validate all the things',
817
favicon: 'img/favicon.ico',
918

1019
// 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/`,
1221
// Set the /<baseUrl>/ pathname under which your site is served
1322
// For GitHub pages deployment, it is often '/<projectName>/'
14-
baseUrl: '/docs',
23+
baseUrl: deployingToNetlify ? `/` : `/${githubRepo}`,
1524

1625
// GitHub pages deployment config.
1726
// 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.
2029
trailingSlash: false,
2130

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+
2235
onBrokenLinks: 'throw',
23-
onBrokenMarkdownLinks: 'warn',
36+
onBrokenAnchors: 'throw',
37+
onBrokenMarkdownLinks: 'throw',
2438

2539
// Even if you don't use internationalization, you can use this field to set
2640
// useful metadata like html lang. For example, if your site is Chinese, you
@@ -81,7 +95,7 @@ const config: Config = {
8195
position: 'left',
8296
label: 'Tutorial',
8397
},
84-
{to: '/blog', label: 'Blog', position: 'left'},
98+
{ to: '/blog', label: 'Blog', position: 'left' },
8599
{
86100
href: 'https://github.com/facebook/docusaurus',
87101
label: 'GitHub',

0 commit comments

Comments
 (0)