@@ -8,9 +8,7 @@ import sidebarsUnversioned from "./sidebarsUnversioned";
88
99const extractPreprocessor = require ( "./plugins/extract-preprocessor" ) ;
1010
11- const generateCurrentAndNextRedirects = (
12- s : string ,
13- ) : { from : string ; to : string } [ ] => [
11+ const generateCurrentAndNextRedirects = ( s : string ) : { from : string ; to : string } [ ] => [
1412 {
1513 from : `/docs/${ s } ` ,
1614 to : `/u/${ s } ` ,
@@ -21,7 +19,9 @@ const generateCurrentAndNextRedirects = (
2119 } ,
2220] ;
2321
24- function handleSidebarItems ( items : any [ ] ) : any [ ] {
22+ type SidebarItem = string | { id ?: string ; link ?: { id ?: string } ; items ?: SidebarItem [ ] } ;
23+
24+ function handleSidebarItems ( items : SidebarItem [ ] ) : { from : string ; to : string } [ ] {
2525 const arr = [ ] ;
2626 for ( const item of items ) {
2727 if ( typeof item === "string" ) {
@@ -34,7 +34,7 @@ function handleSidebarItems(items: any[]): any[] {
3434}
3535
3636// This function generates redirects for all items in the unversioned sidebars, so that if we move a doc from versioned to unversioned, we don't break existing links. It handles both string items (doc ids) and nested objects (categories with their own items).
37- const backportRedirect = ( s : any ) : any [ ] => {
37+ const backportRedirect = ( s : SidebarItem ) : { from : string ; to : string } [ ] => {
3838 const arr = [ ] ;
3939 if ( typeof s === "string" ) {
4040 arr . push ( ...generateCurrentAndNextRedirects ( s ) ) ;
@@ -56,9 +56,7 @@ const backportRedirect = (s: any): any[] => {
5656const currentYear = new Date ( ) . getFullYear ( ) ;
5757
5858const ACADEMY_URL = `https://academy.crowdsec.net/courses?${
59- process . env . NODE_ENV === "production"
60- ? "utm_source=docs&utm_medium=menu&utm_campaign=top-menu&utm_id=academydocs"
61- : ""
59+ process . env . NODE_ENV === "production" ? "utm_source=docs&utm_medium=menu&utm_campaign=top-menu&utm_id=academydocs" : ""
6260} `;
6361
6462/** IF you make significant changes to the nav bar or side bars
@@ -241,11 +239,7 @@ const redirects = [
241239function redirectsGlobalDataPlugin ( ) {
242240 return {
243241 name : "redirects-global-data" ,
244- async contentLoaded ( {
245- actions,
246- } : {
247- actions : { setGlobalData : ( data : unknown ) => void } ;
248- } ) {
242+ async contentLoaded ( { actions } : { actions : { setGlobalData : ( data : unknown ) => void } } ) {
249243 actions . setGlobalData ( { redirects } ) ;
250244 } ,
251245 } ;
@@ -259,8 +253,7 @@ const config: Config = {
259253 experimental_faster : true ,
260254 } ,
261255 title : "CrowdSec" ,
262- tagline :
263- "CrowdSec - Real-time & crowdsourced protection against aggressive IPs" ,
256+ tagline : "CrowdSec - Real-time & crowdsourced protection against aggressive IPs" ,
264257 url : "https://docs.crowdsec.net" ,
265258 baseUrl : "/" ,
266259 onBrokenLinks : "warn" ,
@@ -341,8 +334,7 @@ const config: Config = {
341334 {
342335 docs : {
343336 sidebarPath : "./sidebars.ts" ,
344- editUrl :
345- "https://github.com/crowdsecurity/crowdsec-docs/edit/main/crowdsec-docs/" ,
337+ editUrl : "https://github.com/crowdsecurity/crowdsec-docs/edit/main/crowdsec-docs/" ,
346338 lastVersion : "current" ,
347339 versions : {
348340 "v1.7" : {
@@ -360,8 +352,7 @@ const config: Config = {
360352 } ,
361353 blog : {
362354 showReadingTime : true ,
363- editUrl :
364- "https://github.com/crowdsecurity/crowdsec-docs/edit/main/crowdsec-docs/" ,
355+ editUrl : "https://github.com/crowdsecurity/crowdsec-docs/edit/main/crowdsec-docs/" ,
365356 } ,
366357 theme : {
367358 customCss : "./src/css/custom.css" ,
@@ -412,14 +403,12 @@ const config: Config = {
412403 {
413404 title : "CrowdSec Hub" ,
414405 url : "https://hub.crowdsec.net/" ,
415- description :
416- "Browse and install parsers, scenarios, collections, and remediation components" ,
406+ description : "Browse and install parsers, scenarios, collections, and remediation components" ,
417407 } ,
418408 {
419409 title : "CrowdSec Console" ,
420410 url : "https://app.crowdsec.net/" ,
421- description :
422- "Manage your CrowdSec deployments and access the community blocklist" ,
411+ description : "Manage your CrowdSec deployments and access the community blocklist" ,
423412 } ,
424413 {
425414 title : "GitHub Repository" ,
0 commit comments