@@ -18,7 +18,7 @@ const {
18
18
getDocSection,
19
19
buildBreadcrumbs,
20
20
dedupePath,
21
- noTrailingSlash ,
21
+ addTrailingSlash ,
22
22
removeEnPrefix,
23
23
translatePath,
24
24
getSlug,
@@ -179,7 +179,7 @@ function getSupplementaryPagesProps({
179
179
return {
180
180
path : compose (
181
181
removeEnPrefix ,
182
- noTrailingSlash ,
182
+ addTrailingSlash ,
183
183
dedupePath ,
184
184
slugify ,
185
185
) ( path ) ,
@@ -222,15 +222,16 @@ function getSupplementaryPagesProps({
222
222
return {
223
223
path : compose (
224
224
removeEnPrefix ,
225
- noTrailingSlash ,
225
+ addTrailingSlash ,
226
226
dedupePath ,
227
227
slugify ,
228
228
) ( path ) ,
229
229
component : Path . resolve ( './src/templates/docs/breadcrumb-stub.js' ) ,
230
230
context : {
231
231
sidebarTree : getGuidesSidebar ( locale ) ,
232
232
breadcrumbs : breadcrumbs . filter (
233
- ( item ) => ! SUPPORTED_LOCALES . includes ( item . path . replace ( '/' , '' ) ) ,
233
+ ( item ) =>
234
+ ! SUPPORTED_LOCALES . includes ( item . path . replace ( / \/ / g, '' ) ) ,
234
235
) ,
235
236
title : meta . title ,
236
237
navLinks : generateTopLevelLinks ( topLevelLinks ) ,
@@ -273,7 +274,7 @@ function getTopLevelPagesProps({
273
274
}
274
275
275
276
return {
276
- path : slug === 'guides' ? `/` : `/${ slug } ` ,
277
+ path : slug === 'guides' ? `/` : `/${ slug } / ` ,
277
278
component : Path . resolve ( `./src/templates/docs/${ slug } .js` ) ,
278
279
context : {
279
280
sidebarTree : getSidebar ( name ) ,
@@ -283,7 +284,7 @@ function getTopLevelPagesProps({
283
284
} )
284
285
. concat (
285
286
SUPPORTED_LOCALES . map ( ( locale ) => ( {
286
- path : locale === 'en' ? '/' : `/${ locale } ` ,
287
+ path : locale === 'en' ? '/' : `/${ locale } / ` ,
287
288
component : Path . resolve ( `./src/templates/docs/guides.js` ) ,
288
289
context : {
289
290
sidebarTree : getGuidesSidebar ( locale ) ,
@@ -332,7 +333,7 @@ function getDocPagesProps({
332
333
const strippedDirectory = stripDirectoryPath ( relativeDirectory , 'docs' ) ;
333
334
const path = `${ strippedDirectory } /${ title . replace ( / \/ / g, '-' ) } ` ;
334
335
335
- const slug = customSlug || getSlug ( path ) ;
336
+ const slug = customSlug ? addTrailingSlash ( customSlug ) : getSlug ( path ) ;
336
337
// path collision check
337
338
if ( ! pathCollisionDetectorInstance . add ( { path : slug , name } ) . isUnique ( ) ) {
338
339
// skip the page creation if there is already a page with identical url
@@ -425,7 +426,7 @@ function getGuidesPagesProps({
425
426
? getSlug ( path )
426
427
: getTranslatedSlug ( relativeDirectory , title , pageLocale , 'guides' ) ;
427
428
428
- const pageSlug = customSlug || slug ;
429
+ const pageSlug = customSlug ? addTrailingSlash ( customSlug ) : slug ;
429
430
430
431
// path collision check
431
432
if ( ! pathCollisionDetectorInstance . add ( { path : slug , name } ) . isUnique ( ) ) {
@@ -480,7 +481,7 @@ function getGuidesPagesProps({
480
481
remarkNode : extendedRemarkNode ,
481
482
sidebarTree,
482
483
breadcrumbs : breadcrumbs . filter (
483
- ( item ) => ! SUPPORTED_LOCALES . includes ( item . path . replace ( '/' , '' ) ) ,
484
+ ( item ) => ! SUPPORTED_LOCALES . includes ( item . path . replace ( / \/ / g , '' ) ) ,
484
485
) ,
485
486
navLinks : generateTopLevelLinks ( topLevelLinks ) ,
486
487
locale : pageLocale ,
@@ -594,7 +595,7 @@ async function createDocPages({
594
595
. filter ( ( name ) => name !== 'Cloud REST API' )
595
596
. map ( ( name ) => ( {
596
597
label : name === 'cloud' ? 'Cloud Docs' : name . toUpperCase ( ) ,
597
- to : name === 'guides' ? `/` : `/${ slugify ( name ) } ` ,
598
+ to : name === 'guides' ? `/` : `/${ slugify ( name ) } / ` ,
598
599
} ) ) ;
599
600
600
601
getDocPagesProps ( {
@@ -634,14 +635,14 @@ const createRedirects = ({ actions }) => {
634
635
const { createRedirect } = actions ;
635
636
636
637
createRedirect ( {
637
- fromPath : '/getting-started/welcome' ,
638
+ fromPath : '/getting-started/welcome/ ' ,
638
639
toPath : '/' ,
639
640
redirectInBrowser : true ,
640
641
isPermanent : true ,
641
642
} ) ;
642
643
createRedirect ( {
643
- fromPath : '/es/empezando/bienvenido' ,
644
- toPath : '/es' ,
644
+ fromPath : '/es/empezando/bienvenido/ ' ,
645
+ toPath : '/es/ ' ,
645
646
redirectInBrowser : true ,
646
647
isPermanent : true ,
647
648
} ) ;
0 commit comments