File tree Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -36,19 +36,11 @@ const GlossaryInjector: React.FC<GlossaryInjectorProps> = ({ children }) => {
3636 const path = window . location . pathname ;
3737
3838 // 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 ) ? / ) ) {
39+ const localePrefix = '(?:/ja-jp)?' ; // Matches either '/ja-jp' or nothing
40+ if ( path . match ( new RegExp ( `${ localePrefix } /docs/latest/?$` ) ) ||
41+ path . match ( new RegExp ( `${ localePrefix } /docs/latest/index(\\.html)?` ) ) ||
42+ path . match ( new RegExp ( `${ localePrefix } /docs/[0-9]+\\.[0-9]+/?$` ) ) ||
43+ path . match ( new RegExp ( `${ localePrefix } /docs/[0-9]+\\.[0-9]+/index(\\.html)?` ) ) ) {
5244 return true ;
5345 }
5446 }
You can’t perform that action at this time.
0 commit comments