Skip to content

Commit d757e19

Browse files
committed
Update the links.
1 parent 6e5d524 commit d757e19

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

index.html

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@
3939
</a>
4040
</li>
4141
<li class="nav-item">
42-
<a href="en/getting-started.md" class="nav-link">
42+
<a href="en/getting-started.html" class="nav-link">
4343
<ion-icon name="rocket-outline"></ion-icon>
4444
<span>Getting Started</span>
4545
</a>
4646
</li>
4747
<li class="nav-item">
48-
<a href="en/core-concepts.md" class="nav-link">
48+
<a href="en/core-concepts.html" class="nav-link">
4949
<ion-icon name="book-outline"></ion-icon>
5050
<span>Core Concepts</span>
5151
</a>
5252
</li>
5353
<li class="nav-item">
54-
<a href="en/api/README.md" class="nav-link">
54+
<a href="en/api/README.html" class="nav-link">
5555
<ion-icon name="code-slash-outline"></ion-icon>
5656
<span>API Reference</span>
5757
</a>
@@ -94,7 +94,7 @@ <h1 class="hero-title">A lightweight Java framework for modern apps</h1>
9494
</p>
9595

9696
<div class="hero-actions">
97-
<a href="en/getting-started.md" class="btn btn-primary">
97+
<a href="en/getting-started.html" class="btn btn-primary">
9898
Get Started
9999
<ion-icon name="arrow-forward-outline" style="margin-left: 0.5rem;"></ion-icon>
100100
</a>
@@ -363,31 +363,33 @@ <h4>Zero Configuration</h4>
363363
sidebarLinks.forEach((link, index) => {
364364
const key = sidebarKeys[index];
365365
const span = link.querySelector('span');
366-
if (span) {
366+
if (span && t['sidebar'][key]) {
367367
span.textContent = t['sidebar'][key];
368368
}
369369

370370
// Update hrefs for documentation links
371371
if (key === 'Getting Started' || key === 'Core Concepts' || key === 'API Reference') {
372372
const originalHref = link.getAttribute('href');
373-
const isZh = currentLang === 'zh';
374-
375-
if (isZh && originalHref.startsWith('en/')) {
376-
link.setAttribute('href', originalHref.replace('en/', 'zh/'));
377-
} else if (!isZh && originalHref.startsWith('zh/')) {
378-
link.setAttribute('href', originalHref.replace('zh/', 'en/'));
373+
if (originalHref) {
374+
if (currentLang === 'zh' && originalHref.startsWith('en/')) {
375+
link.setAttribute('href', originalHref.replace('en/', 'zh/'));
376+
} else if (currentLang === 'en' && originalHref.startsWith('zh/')) {
377+
link.setAttribute('href', originalHref.replace('zh/', 'en/'));
378+
}
379379
}
380380
}
381+
});
381382

382-
// Update Hero Button Link
383-
const heroBtn = document.querySelector('.btn-primary');
384-
const heroHref = heroBtn.getAttribute('href');
383+
// Update Hero Button Link
384+
const heroBtn = document.querySelector('.btn-primary');
385+
const heroHref = heroBtn.getAttribute('href');
386+
if (heroHref) {
385387
if (currentLang === 'zh' && heroHref.startsWith('en/')) {
386388
heroBtn.setAttribute('href', heroHref.replace('en/', 'zh/'));
387389
} else if (currentLang === 'en' && heroHref.startsWith('zh/')) {
388390
heroBtn.setAttribute('href', heroHref.replace('zh/', 'en/'));
389391
}
390-
});
392+
}
391393
}
392394
</script>
393395
</body>

0 commit comments

Comments
 (0)