@@ -18,7 +18,7 @@ const Chapters = ({ chapterData, courseData, location, serviceMeshesList, TOCDat
1818 const serviceMeshImages = courseData . frontmatter . meshesYouLearn || [ ] ;
1919 const tableOfContents = TOCData
2020 . filter ( node => ! ! node . fields . section )
21- . map ( toc => ( { section : toc . fields . section , chapter : toc . fields . chapter } ) ) ;
21+ . map ( toc => ( { section : toc . fields . section , chapter : toc . fields . chapter } ) ) ;
2222
2323
2424 const replaceSlugPart = ( index ) => ( oldSlug ) => ( replacement ) => {
@@ -30,23 +30,30 @@ const Chapters = ({ chapterData, courseData, location, serviceMeshesList, TOCDat
3030 const replaceChapterInSlug = ( slugWithReplacedMesh ) => replaceSlugPart ( 5 ) ( slugWithReplacedMesh ) ;
3131
3232 useEffect ( ( ) => {
33- localStorage . setItem ( `bookmarkpath-${ location . pathname . split ( "/" ) [ 4 ] } ` , location . pathname ) ;
33+
34+ let bookmarkPath = location . pathname ;
35+ if ( bookmarkPath . endsWith ( ".html" ) ) {
36+ bookmarkPath = bookmarkPath . replace ( ".html" , "" ) ;
37+ }
38+ localStorage . setItem ( `bookmarkpath-${ location . pathname . split ( "/" ) [ 4 ] } ` , bookmarkPath ) ;
3439 } , [ ] ) ;
3540
3641 const isMeshActive = ( sm ) => chapterData . fields . slug . split ( "/" ) [ 4 ] === sm ;
3742
3843 const mapMeshWithFormattedSlug = ( sm , serviceMeshes ) => {
3944 let chapterFound = false ;
4045 tableOfContents . forEach ( toc => {
41- if ( toc . section === sm . fields . section ) {
46+ if ( toc . section === sm . fields . section ) {
4247 if ( toc . chapter === chapterData . fields . slug . split ( "/" ) [ 5 ] ) chapterFound = true ;
4348 }
4449 } ) ;
4550
4651 if ( ! serviceMeshes . map ( sm => sm . section ) . includes ( sm . fields . section ) )
47- serviceMeshes . push ( { section : sm . fields . section , slug : chapterFound ?
48- replaceServiceMeshInSlug ( sm . fields . section )
49- : replaceChapterInSlug ( replaceServiceMeshInSlug ( sm . fields . section ) ) ( tableOfContents [ 0 ] . chapter ) } ) ;
52+ serviceMeshes . push ( {
53+ section : sm . fields . section , slug : chapterFound ?
54+ replaceServiceMeshInSlug ( sm . fields . section )
55+ : replaceChapterInSlug ( replaceServiceMeshInSlug ( sm . fields . section ) ) ( tableOfContents [ 0 ] . chapter )
56+ } ) ;
5057
5158 } ;
5259
@@ -86,7 +93,7 @@ const Chapters = ({ chapterData, courseData, location, serviceMeshesList, TOCDat
8693 </ > ) ;
8794 } ) ;
8895
89- if ( showQuizModal ) {
96+ if ( showQuizModal ) {
9097 return < QuizModal /> ;
9198 }
9299
@@ -99,7 +106,7 @@ const Chapters = ({ chapterData, courseData, location, serviceMeshesList, TOCDat
99106 < div className = "toc-switcher-parent-div" >
100107 < TOC courseData = { courseData } TOCData = { TOCData } chapterData = { chapterData } location = { location } />
101108 < div >
102- { serviceMeshImages . length !== 0 && availableServiceMeshesArray . length != 0 && (
109+ { serviceMeshImages . length !== 0 && availableServiceMeshesArray . length != 0 && (
103110 < >
104111 < h4 > Technologies Available</ h4 >
105112 < div className = "service-mesh-switcher" >
0 commit comments