1- import  { provide }  from  "vue" ; 
2- import  { defineClientConfig }  from  "@vuepress/client" ; 
1+ import  {   provide ,   onMounted ,   onBeforeUnmount ,   nextTick   }  from  "vue" ; 
2+ import  {   defineClientConfig   }  from  "@vuepress/client" ; 
33import  mitt  from  'mitt' ; 
4- 
54import  Layout  from  "./theme/layouts/Layout.vue" ; 
65import  HomeLayout  from  "./theme/layouts/HomeLayout.vue" ; 
76import  NotFound  from  "./theme/layouts/NotFound.vue" ; 
8- 
97import  bottomLinks  from  "./config-client/bottomLinks" ; 
108import  navbarLinks  from  "./config-client/navbarLinks" ; 
119import  documents  from  "./config-client/documents" ; 
1210import  sidebar  from  "./config-client/sidebar" ; 
1311import  social  from  "./config-client/social" ; 
1412import  Chat  from  "./components/Chat.vue" ; 
1513
14+ declare  const  __VUEPRESS_DEV__ : boolean ; 
15+ 
1616export  default  defineClientConfig ( { 
17-          rootComponents : [ 
17+     rootComponents : [ 
1818        Chat , 
1919    ] , 
20-     async  enhance ( {  app } )  { 
20+     async  enhance ( {  app,  router } )  { 
21+         // Existing event bus setup 
2122        app . config . globalProperties . $eventBus  =  mitt ( ) ; 
23+ 
24+         // Add anchor navigation handling 
25+         if  ( ! __VUEPRESS_DEV__ )  { 
26+             const  handleAnchorClick  =  ( event : MouseEvent )  =>  { 
27+                 const  target  =  event . target  as  HTMLElement ; 
28+                 const  anchor  =  target . closest ( 'a' ) ; 
29+                 
30+                 if  ( anchor ?. hash  &&  anchor . origin  ===  window . location . origin )  { 
31+                     event . preventDefault ( ) ; 
32+                     
33+                     const  hash  =  anchor . hash ; 
34+                     nextTick ( ( )  =>  { 
35+                         const  element  =  document . querySelector ( hash ) ; 
36+                         if  ( element )  { 
37+                             // Add offset for fixed header if needed 
38+                             const  headerOffset  =  80 ;  // Adjust based on your header height 
39+                             const  elementPosition  =  element . getBoundingClientRect ( ) . top ; 
40+                             const  offsetPosition  =  elementPosition  +  window . pageYOffset  -  headerOffset ; 
41+ 
42+                             window . scrollTo ( { 
43+                                 top : offsetPosition , 
44+                                 behavior : 'smooth' 
45+                             } ) ; 
46+                             
47+                             // Update URL without full page reload 
48+                             window . history . pushState ( null ,  '' ,  hash ) ; 
49+                         } 
50+                     } ) ; 
51+                 } 
52+             } ; 
53+ 
54+             // Handle initial hash on page load 
55+             router . afterEach ( ( )  =>  { 
56+                 if  ( window . location . hash )  { 
57+                     nextTick ( ( )  =>  { 
58+                         const  element  =  document . querySelector ( window . location . hash ) ; 
59+                         if  ( element )  { 
60+                             const  headerOffset  =  80 ;  // Adjust based on your header height 
61+                             const  elementPosition  =  element . getBoundingClientRect ( ) . top ; 
62+                             const  offsetPosition  =  elementPosition  +  window . pageYOffset  -  headerOffset ; 
63+ 
64+                             window . scrollTo ( { 
65+                                 top : offsetPosition , 
66+                                 behavior : 'smooth' 
67+                             } ) ; 
68+                         } 
69+                     } ) ; 
70+                 } 
71+             } ) ; 
72+ 
73+             // Add event listeners 
74+             onMounted ( ( )  =>  { 
75+                 document . addEventListener ( 'click' ,  handleAnchorClick ) ; 
76+             } ) ; 
77+ 
78+             onBeforeUnmount ( ( )  =>  { 
79+                 document . removeEventListener ( 'click' ,  handleAnchorClick ) ; 
80+             } ) ; 
81+         } 
2282    } , 
2383    layouts : { 
2484        Layout, 
@@ -35,10 +95,8 @@ export default defineClientConfig({
3595            githubMainDir : "docs" , 
3696            githubRepository : "cloudlinux/imunify360-documentation" , 
3797            MOBILE_BREAKPOINT : 767 , 
38- 
3998            //docs cards 
4099            documents, 
41- 
42100            // icons 
43101            arrowDownIcon : "arrows/arrow-down.svg" , 
44102            githubEditIcon : 'global/pen.svg' , 
@@ -47,11 +105,9 @@ export default defineClientConfig({
47105            siteLogo : "global/logo.svg" , 
48106            searchSelectIcon : 'arrows/select-down.svg' , 
49107            headerSearchIcon : 'global/header-search.svg' , 
50- 
51108            // Header 
52109            headerSearch : "Imunify360 Product Documentation" , 
53110            headerSearchPlaceholder : "Search across all Imunify360 product documentation" , 
54- 
55111            //locales 
56112            locales : { 
57113                bottomLinks, 
@@ -61,22 +117,18 @@ export default defineClientConfig({
61117                stayInTouch : "Stay in touch" , 
62118                navbarLinks : navbarLinks , 
63119            } , 
64- 
65120            // Products 
66121            productsList : [ 'Cloudlinux' ,  'Imunify' ,  'TuxCare' ] , 
67122            productsTitle : 'Products' , 
68123            productsURLs : [ 'https://docs.cloudlinux.com' ,  'https://docs.imunify360.com' ,  'https://docs.tuxcare.com' ] , 
69- 
70124            //social links for footer 
71125            social, 
72- 
73126            // Algolia 
74127            algoliaOptions : { 
75128                apiKey : "e6b9d79daf71aa98e2e2a51d4556f9d4" , 
76129                indexName : "imunify360-unified" , 
77130                appId : "0TCNL6CGX8" , 
78131            } , 
79- 
80132            MAX_VISIBLE_RESULT : 12 , 
81133            MAX_VISIBLE_ROWS : 12 , 
82134            MAX_HITS_PER_PAGE : 12 , 
0 commit comments