forked from seankwalker/fidesdocs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
36 lines (33 loc) · 1.09 KB
/
next.config.js
File metadata and controls
36 lines (33 loc) · 1.09 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
// NOTE: This is set to ETHYCA_SITE_URL="https://ethyca.com" when hosting on Vercel here:
// https://vercel.com/ethyca/fidesdocs/settings/environment-variables
const ETHYCA_SITE_URL = process.env["ETHYCA_SITE_URL"] || "";
const withNextra = require("nextra")({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.js",
flexsearch: {
codeblocks: false,
},
staticImage: true,
defaultShowCopyCode: true,
});
module.exports = withNextra({
basePath: "/docs",
trailingSlash: false,
async redirects() {
return [
{
// Use a regex match to redirect all URLs to the /docs sub-directory, *except* URLs
// that already start with "docs". This prevents an infinite redirect loop of
// redirecting from /docs -> /docs/docs -> /docs/docs/doc...
//
// ((?!docs).*) <=== full regex
// ^^^^^^^^ <=== negative match for "docs"
// ^^ <=== match any character
source: '/:path((?!docs).*)',
destination: `${ETHYCA_SITE_URL}/docs/:path`,
permanent: true,
basePath: false,
},
]
}
});