Skip to content

Commit

Permalink
Merge pull request #178 from NASA-AMMOS/issue-177
Browse files Browse the repository at this point in the history
Add redirect functionality from legacy detect-secrets page to new documentation path
  • Loading branch information
yunks128 authored Nov 2, 2024
2 parents e6669b5 + fa8e789 commit ace7547
Show file tree
Hide file tree
Showing 4 changed files with 1,517 additions and 1,569 deletions.
54 changes: 33 additions & 21 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,18 @@ const config = {
tagline: 'Software Lifecycle Improvement & Modernization (SLIM)',
favicon: '/img/favicon.ico',


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

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'nasa-ammos', // Usually your GitHub org/user name.
projectName: 'slim', // Usually your repo name.
organizationName: 'nasa-ammos',
projectName: 'slim',

onBrokenLinks: 'ignore',
onBrokenMarkdownLinks: 'ignore',

// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
locales: ['en'],
Expand All @@ -40,18 +34,12 @@ const config = {
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl:
'https://github.com/nasa-ammos/slim/tree/main/',
editUrl: 'https://github.com/nasa-ammos/slim/tree/main/',
sidebarCollapsed: true,
},
blog: {
showReadingTime: true,
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl:
'https://github.com/nasa-ammos/slim/tree/main/',
editUrl: 'https://github.com/nasa-ammos/slim/tree/main/',
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
Expand All @@ -63,7 +51,6 @@ const config = {
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// Replace with your project's social card
image: 'img/docusaurus-social-card.jpg',
navbar: {
title: 'SLIM',
Expand Down Expand Up @@ -158,11 +145,36 @@ const config = {
respectPrefersColorScheme: false
},
}),

markdown: {
mermaid: true,
},

themes: ['@docusaurus/theme-mermaid'],

plugins: [
[
'@docusaurus/plugin-client-redirects',
{
redirects: [
{
from: [
'/continuous-testing/starter-kits', // without baseUrl
'/slim/continuous-testing/starter-kits', // with baseUrl
],
to: '/docs/guides/software-lifecycle/security/secrets-detection/',
},
],
},
],
],

markdown: {
mermaid: true,
scripts: [
{
src: '/js/redirect-handler.js',
async: true,
},
themes: ['@docusaurus/theme-mermaid']
],
};

module.exports = config;
module.exports = config;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"@docusaurus/core": "2.4.1",
"@docusaurus/plugin-client-redirects": "^2.4.1",
"@docusaurus/preset-classic": "2.4.1",
"@docusaurus/theme-mermaid": "^2.4.1",
"@mdx-js/react": "^1.6.22",
Expand Down
7 changes: 7 additions & 0 deletions static/js/redirect-handler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// To handle the specific hash/anchor
(function() {
if (window.location.hash === '#detect-secrets' &&
window.location.pathname === '/slim/continuous-testing/starter-kits') {
window.location.href = '/slim/docs/guides/software-lifecycle/security/secrets-detection/';
}
})();
Loading

0 comments on commit ace7547

Please sign in to comment.