File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,33 @@ const GlossaryInjector: React.FC<GlossaryInjectorProps> = ({ children }) => {
3030 . catch ( ( err ) => console . error ( 'Failed to load glossary:' , err ) ) ;
3131 } , [ ] ) ;
3232
33+ // Function to check if the current page is a version index page
34+ const isVersionIndexPage = ( ) => {
35+ if ( typeof window !== 'undefined' ) {
36+ const path = window . location . pathname ;
37+
38+ // Check for various version index patterns
39+ // English versions
40+ if ( path . match ( / \/ d o c s \/ l a t e s t \/ ? $ / ) ||
41+ path . match ( / \/ d o c s \/ l a t e s t \/ i n d e x ( \. h t m l ) ? / ) ||
42+ path . match ( / \/ d o c s \/ [ 0 - 9 ] + \. [ 0 - 9 ] + \/ ? $ / ) ||
43+ path . match ( / \/ d o c s \/ [ 0 - 9 ] + \. [ 0 - 9 ] + \/ i n d e x ( \. h t m l ) ? / ) ) {
44+ return true ;
45+ }
46+
47+ // Japanese versions
48+ if ( path . match ( / \/ j a - j p \/ d o c s \/ l a t e s t \/ ? $ / ) ||
49+ path . match ( / \/ j a - j p \/ d o c s \/ l a t e s t \/ i n d e x ( \. h t m l ) ? / ) ||
50+ path . match ( / \/ j a - j p \/ d o c s \/ [ 0 - 9 ] + \. [ 0 - 9 ] + \/ ? $ / ) ||
51+ path . match ( / \/ j a - j p \/ d o c s \/ [ 0 - 9 ] + \. [ 0 - 9 ] + \/ i n d e x ( \. h t m l ) ? / ) ) {
52+ return true ;
53+ }
54+ }
55+ return false ;
56+ } ;
57+
3358 useEffect ( ( ) => {
34- if ( Object . keys ( glossary ) . length === 0 ) return ;
59+ if ( Object . keys ( glossary ) . length === 0 || isVersionIndexPage ( ) ) return ;
3560
3661 // Sort terms in descending order by length to prioritize multi-word terms.
3762 const terms = Object . keys ( glossary ) . sort ( ( a , b ) => b . length - a . length ) ;
You can’t perform that action at this time.
0 commit comments