Jump to content

Template:BookNav: Difference between revisions

From transformal GmbH
Created page with "<!-- ============================================ Template:BookNav v260201r1 Hidden data for book navigation (Preprint v7.17) Parameters: book= (required) Book root path root-anchor= (optional) Anchor in book root for this article ============================================ --> <div class="book-nav-data" data-book="{{{book|}}}" {{#if:{{{root-anchor|}}}|data-root-anchor="{{{root-anchor|}}}"|}} style="display:..."
 
No edit summary
 
Line 43: Line 43:
JS compares current page name to <code>book=</code> value. Match = book root, no match = chapter.
JS compares current page name to <code>book=</code> value. Match = book root, no match = chapter.


[[Category:Preprint]]
</noinclude>
</noinclude>

Latest revision as of 13:23, 26 July 2026

Documentation

Usage

On chapter pages:

{{BookNav
|book=Erzählungen:MeinBuch
|root-anchor=Artikel_4
}}

On book root page:

{{BookNav
|book=Erzählungen:MeinBuch
}}

Parameters

  • book (required): Root path of the book (namespace:title)
  • root-anchor (optional): Anchor ID in book root corresponding to this article

Behavior

Outputs hidden data element. JavaScript creates a navigation icon:

  • On chapter pages: icon saves reading position and navigates to book root
  • On book root: icon returns to saved reading position

Detection

JS compares current page name to book= value. Match = book root, no match = chapter.