Skip to content

Commit fa8e789

Browse files
committed
redirect fix
1 parent e6669b5 commit fa8e789

File tree

4 files changed

+1517
-1569
lines changed

4 files changed

+1517
-1569
lines changed

docusaurus.config.js

+33-21
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,18 @@ const config = {
1010
tagline: 'Software Lifecycle Improvement & Modernization (SLIM)',
1111
favicon: '/img/favicon.ico',
1212

13-
1413
// Set the production url of your site here
1514
url: 'https://nasa-ammos.github.io',
1615
// Set the /<baseUrl>/ pathname under which your site is served
17-
// For GitHub pages deployment, it is often '/<projectName>/'
1816
baseUrl: '/slim/',
1917

2018
// GitHub pages deployment config.
21-
// If you aren't using GitHub pages, you don't need these.
22-
organizationName: 'nasa-ammos', // Usually your GitHub org/user name.
23-
projectName: 'slim', // Usually your repo name.
19+
organizationName: 'nasa-ammos',
20+
projectName: 'slim',
2421

2522
onBrokenLinks: 'ignore',
2623
onBrokenMarkdownLinks: 'ignore',
2724

28-
// Even if you don't use internalization, you can use this field to set useful
29-
// metadata like html lang. For example, if your site is Chinese, you may want
30-
// to replace "en" with "zh-Hans".
3125
i18n: {
3226
defaultLocale: 'en',
3327
locales: ['en'],
@@ -40,18 +34,12 @@ const config = {
4034
({
4135
docs: {
4236
sidebarPath: require.resolve('./sidebars.js'),
43-
// Please change this to your repo.
44-
// Remove this to remove the "edit this page" links.
45-
editUrl:
46-
'https://github.com/nasa-ammos/slim/tree/main/',
37+
editUrl: 'https://github.com/nasa-ammos/slim/tree/main/',
4738
sidebarCollapsed: true,
4839
},
4940
blog: {
5041
showReadingTime: true,
51-
// Please change this to your repo.
52-
// Remove this to remove the "edit this page" links.
53-
editUrl:
54-
'https://github.com/nasa-ammos/slim/tree/main/',
42+
editUrl: 'https://github.com/nasa-ammos/slim/tree/main/',
5543
},
5644
theme: {
5745
customCss: require.resolve('./src/css/custom.css'),
@@ -63,7 +51,6 @@ const config = {
6351
themeConfig:
6452
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
6553
({
66-
// Replace with your project's social card
6754
image: 'img/docusaurus-social-card.jpg',
6855
navbar: {
6956
title: 'SLIM',
@@ -158,11 +145,36 @@ const config = {
158145
respectPrefersColorScheme: false
159146
},
160147
}),
148+
149+
markdown: {
150+
mermaid: true,
151+
},
152+
153+
themes: ['@docusaurus/theme-mermaid'],
154+
155+
plugins: [
156+
[
157+
'@docusaurus/plugin-client-redirects',
158+
{
159+
redirects: [
160+
{
161+
from: [
162+
'/continuous-testing/starter-kits', // without baseUrl
163+
'/slim/continuous-testing/starter-kits', // with baseUrl
164+
],
165+
to: '/docs/guides/software-lifecycle/security/secrets-detection/',
166+
},
167+
],
168+
},
169+
],
170+
],
161171

162-
markdown: {
163-
mermaid: true,
172+
scripts: [
173+
{
174+
src: '/js/redirect-handler.js',
175+
async: true,
164176
},
165-
themes: ['@docusaurus/theme-mermaid']
177+
],
166178
};
167179

168-
module.exports = config;
180+
module.exports = config;

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@docusaurus/core": "2.4.1",
18+
"@docusaurus/plugin-client-redirects": "^2.4.1",
1819
"@docusaurus/preset-classic": "2.4.1",
1920
"@docusaurus/theme-mermaid": "^2.4.1",
2021
"@mdx-js/react": "^1.6.22",

static/js/redirect-handler.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// To handle the specific hash/anchor
2+
(function() {
3+
if (window.location.hash === '#detect-secrets' &&
4+
window.location.pathname === '/slim/continuous-testing/starter-kits') {
5+
window.location.href = '/slim/docs/guides/software-lifecycle/security/secrets-detection/';
6+
}
7+
})();

0 commit comments

Comments
 (0)