For this post in this Inside the ePub Format series, I discuss the ncx (navigation center extended) file. This file was an early attempt at creating a way for eBook readers to navigate a document in a way similar to a table of contents.The ePub 3.0+ standards no longer require an ncx file because its successor is the navigation document.
The ncx file does not do away with the need for a table of contents, so a book author typically creates an ncx file and a stand-alone table of contents file. in ePub 3.0, a navigation document replaces the ncx by being both a table of contents and a navigation document. To learn more about the newer navigation document, follow this link to a previous post in this Inside the ePub Format series.
Note: As with all other posts for my Inside the ePub Format posts, Amazon’s Kindle format also supports the ncx file.
Why bother with ncx?
There are a lot of eBook readers out there that have never been updated. In the world of iPads and apps, you typically update your apps on occasion — or even let your device update apps automatically. In the world of stand-alone eBook readers (especially older devices), the owner of the device usually have to know an update is available, plug the device into your computer and run through a somewhat convoluted process to install the update. You just cannot assume people are updating their eBook readers.
Therefore, if you want to sell your eBook to the widest possible audience, it is a good idea to add an ncx file so you can be backward compatible with other eBook readers.
The ncx file
As you can see from the following sample image, the ncx file is an xml file. The file defines how a user navigates the book.
As you can see, the uid is a unique identifier for my eBook. You can define your own unique identifier for your eBook but some authors will use an ISBN (or it may be required by some eBook resellers). If you use a unique identifier in the ncx, make sure you use the same number in all the other appropriate files, like the opf file. Here is what the uid element looks like with an ISBN.
Next up is the depth item. As you can see in the sample below, the ncx file may have up to two levels in the structure of the table of contents. For my example, the book could have a Chapter 1 (first level) and a Chapter 1.1 (second level). If you have more (or less) levels, just change this number, but it a number greater than zero.
The totalPageCount and maxPageNumber items are not important for eBooks since page numbers are rarely used in eBooks. You can omit these altogether or just do as I do, which is to place a 0 (zero) in the content property as shown in the following sample.
<meta name="dtb:maxPageNumber" content="0" />[/xml]
The <navmap> element
In earlier versions of ePub (before ePub 3.0), the eBook reader could display a table of contents file you provide. However, most eBook readers also have their own unique user interface that allows the person reading your book to navigate without the table of contents file. This is why you need an ncx file for older ePub (and Amazon Kindle) formats. Specifically, the eBook reader will use the <navmap> element in the ncx file to provide such a user interface.
Reminder: The ncx file is not required for ePub 3.0+ files, but it is recommended for backward compatibility for older eBook readers. Using an ncx file helps you reach a wider audience.
To build what is essentially a table of contents that an eBook reader can access, you add the <navmap> element to the ncx file. This navmap will contain any number of <navpoint> elements as you can see in the sample below.
<navPoint class="chapter" id="navpoint-1" playOrder="1">
<text>Microsoft Project 2013 2016 Fundamentals</text>
<content src="FUND00_Cover.xhtml" />
<navPoint class="chapter" id="navpoint-2" playOrder="2">
<content src="FUND01_Intro.xhtml" />
<navPoint class="chapter" id="navpoint-3" playOrder="3">
<content src="FUND02_UI.xhtml" />
Each navpoint is essentially a link to your content files (your book). As you can see in the previous example, there are three files that make up my book. Each file is given a label using the <navlabel> element. I define the file I am linking to with the <content src> element.
The navpoint id property is a name I manually assign to each of the items so they have a unique name. A good practice is to add a number that represents the playorder. Speaking of the playorder property, you use this to tell the eBook reader which of the chapters comes first, second, third, and so on.
Like the navigation document, you can also make your content more discoverable by using the pagelist element to denote where each page of your book starts and ends. You can use the navlist element to add more links within your book for, say, a table of figures or a table of tables.
To learn more about extending your ncx file with additional tables, review the IDPF specification for the ncx in this link.
The ncx file was a requirement for older ePub formats and has since been deprecated by the ePub 3.0 navigation document. If you want to reach a wider audience of readers who may still own older eBook readers, you might want to consider adding an ncx file to your ePub file.
The nice thing about ePub 3.0 is it provides all sorts of methods to package up your ePub 3.0 file and still include ePub 2.0 functionality. If you are adding an ncx file to your ePub 3.0, make sure you include references to it in the manifest and spine elements of the opf file. To see how I link the ncx file in a real-world example, look at the sample opf file in this post.