Jump to content

ePub for iBooks: How to Reference an In-Text XHTML Table of Contents in the NCX Table of Contents (ePub 2.1)

0
  elanizzle's Photo
Posted Dec 19 2011 10:11 AM

As part of one of my recent ePub customization projects, the editors wanted to include a graphic in-text table of contents, in addition to the NCX table of contents that you can access at will; they also naturally wanted to include a reference to that XHTML TOC file within the NCX TOC.

I named the XHTML TOC file “contents.html,” with the HTML <title> “Contents”, and I added it to the toc.ncx file as follows:

<navPoint>
    <navLabel>
    <text>Contents</text>
    </navLabel>
    <content src="contents.html"/>
</navPoint>


Everything looked right in Adobe Digital Editions:

Attached Image

But in iBooks, the reference to my Contents page didn’t show up in the NCX TOC:

Attached Image

I tried adjusting the <text> in the toc.ncx to “Table of Contents,” but to no avail. My gut told me that the problem had to be with the word “Contents,” so I went through and changed each occurrence of that word one by one (the HTML filename, the HTML title, and the <text> label in the toc.ncx). It took a bit of time, but I finally narrowed down the problem to the toc.ncx: for some reason, iBooks doesn’t like the word “Contents” or “Table of Contents” in the <text> label there.

The solution was very simple: add a few blank spaces after the word “Contents,” by pressing the space bar (i.e., you don’t need to add nbsp characters or anything fancy like that).*

The new toc.ncx code:

<navPoint>
    <navLabel>
    <text>Contents    </text>
    </navLabel>
    <content src="contents.html"/>
</navPoint>


Success!

Attached Image

*(I also tried adding some Unicode in place of a couple characters in the word “Contents”, but iBooks was too smart for that.)

Tags:
1 Subscribe


0 Replies