Several years ago, I wrote an article about making an NCX file manually. At that time, nearly everybody was using Mobipocket Creator to format Kindle books from Word or HTML files. Amazon decreed that an NCX (Navigation Control XML) file was required, but MPC was not designed to generate one, although it did just about everything else.
An NCX file is a simple XML file listing “navigation points” and is sometimes called the “logical table of contents.”
In eInk Kindles, the NCX was used for the progress bar and for navigating from section to section with the 5-way controller button. Now it populates the “Go To” menu. There’s still a progress bar in Kindle Fire, but it doesn’t have tick marks for “waypoints.” To display it and move quickly to another part of a book, you tap the bottom of the screen and slide the indicator to a new location or “page.”
In ePubs, the NCX determines what links appear in the main navigation panel and may be hierarchical, nesting chapters inside sections and whatnot for a clean-looking expandable menu.
If you use Sigil to convert and polish an HTML version of your book into ePub format, it will create the NCX file for you. You can generate a new NCX file from your HTML header tags at any time using the Sigil menu:
The easiest way is to let it create an NCX from your chapter or section heading tags and then uncheck the unwanted entries.
Your toc.ncx file might look something like this:
Note that the meta uuid tag in the <head> of the toc.ncx file contains a randomly-generated unique identifier for the ePub. If you prefer, you can use your ISBN instead. If you do that, make sure you use the correct syntax. For an example, see What’s in an Identifier? by ThreePress Consulting.
Unlike standard ePubs, Kindle likes a depth of 1 in the toc.ncx, with no nested navPoints. If your book has a depth of 2 (or more), Kindlegen will accept it, but you should check the NCX view in Kindle Previewer. If you end up with only the top-level navPoints, and it’s important that you don’t, you could make a separate copy of your ePub for Kindle and flatten the navPoints to one level manually. To do that, make sure that each individual <navPoint> has a closing </navPoint> tag without enclosing other navPoints, like this:
not like this:
<navPoint id=”navPoint-2″ playOrder=”2″>
Sigil also helps you create the required content.opf (metadata) file, and an HTML Table of Contents. Kindlegen will accept a Sigil-produced ePub as your book source and convert it to a .mobi package file for Amazon KDP. The ePub can also be used for submission to Barnes & Noble, Kobo, iTunes, or other outlets.
I started off assembling ePubs manually, but switched to Sigil, which is a great program and a huge timesaver. It’s good to understand the anatomy of an ePub, but not very productive to manually repeat the same steps for making them when you can do it easier and more reliably with Sigil.
One of the great features of Sigil is built-in code checking with Pretty Print or HTML Tidy and ePub validation with FlightCrew. It’s easy to catch and fix errors as you go and finish with a valid ePub. FlightCrew is a good validator, but not identical to epubcheck, which you can use separately as a command-line Python script or with a simple interface by downloading EPUB-Checker from Pagina.