EPUB2 or EPUB3 and InDesign’s Table of Contents
I’ve been seeing conversations on Twitter recently about some folks exporting EPUB2 files from InDesign. When asked why, those EPUB2-ers cite the Nook, which doesn’t support EPUB3.
There’s no reason to export EPUB2 just because the Nook asks for it.
The main element the Nook is looking for in an EPUB2 document is the toc.ncx, because that’s what it uses to build its navigation.
EPUB 3 has done away with the toc.ncx (except as a backward-looking convenience). Instead, for navigation, it uses an xhtml document (toc.xhtml), with an epub:type of toc.
InDesign can do it
InDesign is very helpful when exporting EPUB3 documents, though. Not only do you get a toc.xhtml, but it also generates the toc.ncx.
That is, InDesign generates both lists as long as you use its Table of Contents builder (Layout – Table of Contents Styles).
It’s easy to use. Simply Add Paragraph Styles to the Include Paragraph Styles column.
Style
No need to assign an Entry Style, since you won’t be generating a TOC within the document.
Page Number: choose No Page Number.
Options
Make sure to check Make text anchor in source paragraph. This will create the live link in your EPUB’s toc.xhtml.
When you Export to EPUB (Reflowable) (File – Export), you’ll see this screen:
General
Choose EPUB 3.0.
Navigation TOC
Choose Multi Level (TOC Style) from the pull-down menu.
Under TOC Style, find the the table of contents you’ve already created (here called epub).
When you export your EPUB, InDesign will automatically create the toc.ncx for EPUB2-reading devices and the toc.xhtml (with <nav id=”toc” epub:type=”toc”> already stated) for EPUB3.
Inside-the-book contents
It’s good practice to include an inside-the-book contents listing (say, between the Introduction and Chapter 1). It’s just an extra help for readers navigating the book, and Amazon requires it.
I used to use InDesign’s Table of Contents builder for both the export-generated and the inside-the-book listings. I would generate the listing in the InDesign doc and place it where I wanted it. It would export along with the rest of the document.
Now, though, I crack open the EPUB and use the toc.xhtml that InDesign has generated. This way it does double-duty: as the device’s navigation tool and the actual content with the book.
I have to remember to add it to the spine in the content.opf (line 48 below):
And, I format the content as I would any content in the rest of the book.
For more on handling the TOC within an EPUB, read Joshua Tallent’s two posts at Digital Book World:
http://www.digitalbookworld.com/2015/best-practices-for-ebook-front-matter-table-of-contents-part-1/
and
http://www.digitalbookworld.com/2015/best-practices-for-ebook-front-matter-table-of-contents-part-2/
I would note that as of the CC2015.2 release, InDesign doesn’t add the CSS stylesheet link to the top of the toc.xhtml, so if you are using it as your main TOC, and to style it, you will either need to add the link yourself or add your styles to the head of your page, if you don’t, you get a very vanilla, unstyled TOC in your ePub.
I havent tested this on the CC2016.1 release, as I have yet to run the update, so it might have been added.
oh forgive me, I see that you addressed this in your next post.