XML technologies / ePUB / ePub für (In)Designer / Editing chapter divisions and navigation

(Excerpt from “ePub für (In)Designer — Mit InDesign Schritt für Schritt zum E-Book” by Sascha Heck & Yves Apel)

Chapter divisions after export

Under Creating a book file and chapters we saw chapter and page breaks. The simplest rule: a new HTML file starts a new page. Manage chapters as separate InDesign documents in the Book panel; each exports as a separate XHTML file. Manual breaks can also be added after export.

Page breaks with Sigil

In Sigil, put the cursor at the split location and choose Insert → Chapter Break.

Sigil quickly splits documents with Insert → Chapter Break

Figure: Sigil quickly splits documents with Insert → Chapter Break.

Sigil names the new file, for example Section0001.xhtml. Rename it if desired, then test links: Sigil should have updated their paths.

Page breaks with CSS

With CSS, insert breaks before or after elements. This CSS creates a break before every heading tagged <h1>.

h1   {     
            page-break-before: always;
       }

CSS: break before each h1 main heading

Figure: Break before each h1 main heading.

To break after an element, use page-break-after. For a single break after one particular paragraph rather than all of its kind, insert the following code on that HTML paragraph instead of centrally in CSS:

<p style="page-break-after: always">Nach diesem Absatz wird umbrochen.</p>

CSS page-break instruction in HTML

Figure: CSS page-break instruction in HTML, breaking after Holzfutter hatten.

Not every e-reader or editor supports this. Sigil ignores it, but Adobe Digital Editions and iBooks work. Test your target first.

Incidentally, the CSS value used for page-break-after and page-break-before is always. There is no Yes.

Editing the navigation map manually

Under Setting up e-book navigation we used InDesign TOC styles for typical e-book navigation. Sometimes manual editing of the navigation map after export is needed: re-exporting loses all other edits already made.

Another case: adding a page not represented by TOC paragraph styles, because not every page has a title. Imprint, title page, dedication or cover are examples requiring manual work.

The destination must exist as an HTML file: navigation references files, not page numbers. See Creating a book file and chapters. You can also create it afterward if ePub already exists.

toc.ncx

Navigation uses the toc.ncx file (Table of Content, Navigation Control file for XML). Recent Sigil, BBEdit and oXygen XML versions open it directly. Otherwise unpack ePub first; see Unpacking an ePub.

Edit toc.ncx directly in Sigil

Figure: Edit toc.ncx directly in Sigil.

Opening toc.ncx reveals a file built from navPoint elements.

<navPoint id="navpoint1"playOrder="1">
   <navLabel>
      <text>1) Geschichte der Entwicklung</text>
   </navLabel>
   <content src="Text/06_Geschichte_Entwicklung.html#toc_marker-1"/>
</navPoint>

Everything between opening <navPoint> and closing </navPoint> tags becomes a navigation entry. Copy an entire such block to add a new entry. Text inside <Text> is what the navigation map displays. <content src="Ziel"/> specifies the action on clicking. Enter the destination HTML path, prefixed Text/ because HTML files reside in Text.

A hash (#) after the filename marks a text anchor, targeting an exact passage. Creating one in InDesign is covered under Cross-references, and manual creation under Creating and editing hyperlinks.

Nested entries

Hierarchies create navigation levels shown with expandable arrows or indentation, depending on reader.

Navigation levels in Adobe Digital Editions

Figure: Adobe Digital Editions uses expandable plus/minus arrows for navigation levels.

InDesign builds hierarchies through paragraph styles included in TOC styles. For manual creation, inspect toc.ncx to understand the mechanism.

Nesting uses the element <navPoint>. Open one tag, then another without closing the first. Only when returning to the first level insert the closing </navPoint> tag.

<navPoint id="navpoint3"playOrder="3">
    <navLabel>
        <text>3) Die Herstellung</text>
    </navLabel>
    <content src="Text/08_Herstellung.html#herstellung"/>
    <navPoint id="navpoint4"playOrder="4">
        <navLabel>
            <text>Der Stahl</text>
        </navLabel>
        <content src="Text/08_Herstellung.html#stahl"/>
    </navPoint>
</navPoint>

Continue similarly to create a third level.

Third level by further nesting navPoint elements

Figure: Third level by further nesting <navPoint> elements.

<navPoint id="navpoint3"playOrder="3">
    <navLabel>
        <text>3) Die Herstellung</text>
    </navLabel>
    <content src="Text/08_Herstellung.html#herstellung"/>
    <navPoint id="navpoint4"playOrder="4">
        <navLabel>
            <text>Der Stahl</text>
        </navLabel>
        <content src="Text/08_Herstellung.html#stahl"/>
        <navPoint id="navpoint4"playOrder="4">
            <navLabel>
                <text>3. Hierarchieebene</text>
            </navLabel>
            <content src="Text/08_Herstellung.html#hierarchie3"/>
        </navPoint>
    </navPoint>
</navPoint>

  

 

 

 

back to top