Skip to content

Commit 6c9e84b

Browse files
piti6claude
andcommitted
fix: fix TOP link navigation in sidebar
Change TOP and cover image links from index.html to ./ to avoid clean URL servers redirecting to the wrong directory level. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c3ea47d commit 6c9e84b

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

articles/layouts/layout-web.html.erb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<nav class="side-content">
2525
<div class="side-header">
2626
<% if @book.config["coverimage"].present? %>
27-
<a href="index.html"><img class="side-cover" src="<%=h @book.config["imagedir"] %>/<%=h @book.config["coverimage"] %>" alt="<%=h @book.config.name_of("booktitle") %>" /></a>
27+
<a href="./" ><img class="side-cover" src="<%=h @book.config["imagedir"] %>/<%=h @book.config["coverimage"] %>" alt="<%=h @book.config.name_of("booktitle") %>" /></a>
2828
<% end %>
2929
<h1 class="side-title"><%=h @book.config.name_of("booktitle") %></h1>
3030
</div>
@@ -76,6 +76,14 @@
7676
return href.replace(/\.html$/, '') === currentPage;
7777
}
7878

79+
// Fix TOP link to use relative directory path instead of index.html
80+
tocItems.forEach(function(li) {
81+
var link = li.querySelector('a');
82+
if (link && link.getAttribute('href') === 'index.html') {
83+
link.setAttribute('href', './');
84+
}
85+
});
86+
7987
tocItems.forEach(function(li) {
8088
var link = li.querySelector('a');
8189
if (!link) return;

0 commit comments

Comments
 (0)