Skip to content

Commit ebdf83b

Browse files
brunoborgesCopilot
andcommitted
Fix locale picker navigation in docs pages
The JS was trying to replace '/docs/' in the URL path, but GitHub Pages serves docs/ as root so the live URL never contains '/docs/'. Use the same base-path approach as the other agent-lab repos. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2e282aa commit ebdf83b

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

docs/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ <h2 class="section-title">Prerequisites</h2>
188188
var t=li.dataset.locale==='pt-BR'?'pt_BR':li.dataset.locale;
189189
if(t===locale){close();return;}
190190
var p=location.pathname;
191-
if(locale!=='en')p=p.replace(new RegExp('/'+locale+'/'),'/');;
192-
if(t!=='en')p=p.replace(/\/docs\//,'/docs/'+t+'/');
191+
if(locale!=='en')p=p.replace(new RegExp('/'+locale+'/'),'/');
192+
if(t!=='en'){var base=p.replace(/\/index\.html$/,'/');if(!base.endsWith('/'))base+='/';p=base+t+'/';}
193193
localStorage.setItem('preferred-locale',t);
194194
window.location.href=p+location.search;
195195
});

docs/step.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,8 @@ <h1>Error Loading Content</h1>
368368
var t=li.dataset.locale==='pt-BR'?'pt_BR':li.dataset.locale;
369369
if(t===locale){close();return;}
370370
var p=location.pathname;
371-
if(locale!=='en')p=p.replace(new RegExp('/'+locale+'/'),'/');;
372-
if(t!=='en')p=p.replace(/\/docs\//,'/docs/'+t+'/');
371+
if(locale!=='en')p=p.replace(new RegExp('/'+locale+'/'),'/');
372+
if(t!=='en'){var base=p.replace(/\/index\.html$/,'/');if(!base.endsWith('/'))base+='/';p=base+t+'/';}
373373
localStorage.setItem('preferred-locale',t);
374374
window.location.href=p+location.search;
375375
});

0 commit comments

Comments
 (0)