fix: use semantic nav/header elements to prevent iOS Reader Mode from including chapter navigation links in article content
Some checks failed
CI / Lint (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Build (push) Has been cancelled

This commit is contained in:
Admin
2026-03-01 20:04:16 +05:00
parent 1222653858
commit c431fc5869

View File

@@ -1015,7 +1015,7 @@ func (s *Server) handleBookChaptersPage(w http.ResponseWriter, r *http.Request)
const chapterTmpl = `
<div class="max-w-2xl mx-auto px-4 py-10">
<div class="flex items-center justify-between mb-8">
<nav aria-label="Chapter navigation" class="flex items-center justify-between mb-8">
<a href="/books/{{.Slug}}"
hx-get="/books/{{.Slug}}"
hx-target="#main-content"
@@ -1046,7 +1046,11 @@ const chapterTmpl = `
</a>
{{end}}
</div>
</div>
</nav>
<header>
<h1 class="text-2xl font-bold text-zinc-100 mb-6">{{.Title}}</h1>
</header>
<!-- TTS player bar — calls Kokoro directly from the browser -->
<div id="tts-bar" class="mb-6 rounded-xl border border-zinc-800 bg-zinc-900 px-4 py-3">
@@ -1093,7 +1097,7 @@ const chapterTmpl = `
{{.HTML}}
</article>
<div class="flex justify-between mt-12 pt-6 border-t border-zinc-800">
<nav aria-label="Chapter pagination" class="flex justify-between mt-12 pt-6 border-t border-zinc-800">
{{if .PrevN}}
<a href="/books/{{.Slug}}/chapters/{{.PrevN}}"
hx-get="/books/{{.Slug}}/chapters/{{.PrevN}}"
@@ -1114,7 +1118,7 @@ const chapterTmpl = `
Next chapter →
</a>
{{else}}<span></span>{{end}}
</div>
</nav>
</div>
<style>
@@ -1750,6 +1754,7 @@ func (s *Server) handleChapter(w http.ResponseWriter, r *http.Request) {
PrevN int
NextN int
ChapterN int
Title string
KokoroURL string
Voices []string
DefaultVoice string
@@ -1759,6 +1764,7 @@ func (s *Server) handleChapter(w http.ResponseWriter, r *http.Request) {
PrevN: prevN,
NextN: nextN,
ChapterN: n,
Title: title,
KokoroURL: s.kokoroURL,
Voices: kokoroVoices,
DefaultVoice: s.kokoroVoice,