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 = ` const chapterTmpl = `
<div class="max-w-2xl mx-auto px-4 py-10"> <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}}" <a href="/books/{{.Slug}}"
hx-get="/books/{{.Slug}}" hx-get="/books/{{.Slug}}"
hx-target="#main-content" hx-target="#main-content"
@@ -1046,7 +1046,11 @@ const chapterTmpl = `
</a> </a>
{{end}} {{end}}
</div> </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 --> <!-- 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"> <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}} {{.HTML}}
</article> </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}} {{if .PrevN}}
<a href="/books/{{.Slug}}/chapters/{{.PrevN}}" <a href="/books/{{.Slug}}/chapters/{{.PrevN}}"
hx-get="/books/{{.Slug}}/chapters/{{.PrevN}}" hx-get="/books/{{.Slug}}/chapters/{{.PrevN}}"
@@ -1114,7 +1118,7 @@ const chapterTmpl = `
Next chapter → Next chapter →
</a> </a>
{{else}}<span></span>{{end}} {{else}}<span></span>{{end}}
</div> </nav>
</div> </div>
<style> <style>
@@ -1750,6 +1754,7 @@ func (s *Server) handleChapter(w http.ResponseWriter, r *http.Request) {
PrevN int PrevN int
NextN int NextN int
ChapterN int ChapterN int
Title string
KokoroURL string KokoroURL string
Voices []string Voices []string
DefaultVoice string DefaultVoice string
@@ -1759,6 +1764,7 @@ func (s *Server) handleChapter(w http.ResponseWriter, r *http.Request) {
PrevN: prevN, PrevN: prevN,
NextN: nextN, NextN: nextN,
ChapterN: n, ChapterN: n,
Title: title,
KokoroURL: s.kokoroURL, KokoroURL: s.kokoroURL,
Voices: kokoroVoices, Voices: kokoroVoices,
DefaultVoice: s.kokoroVoice, DefaultVoice: s.kokoroVoice,