bell notificationshomepageloginedit profileclubsdmBox

10.01% popularity   0 Reactions

Ideally, I'd like to not have a ToC. But I understand that without one, an epub won't validate. Is there any way to create a ToC with no content, including no ToC header?


Free books android app tbrJar TBR JAR Read Free books online gutenberg


Load Full (1)

Login to follow story

More posts by @Sherry

1 Comments

Sorted by latest first Latest Oldest Best

 

@Karen

10% popularity   0 Reactions

I'm guessing that you are asking the question in the wrong way: you actually want to hide the HTML entries from the TOC so that the TOC doesn't spoil any surprises. I have good news. In epub3 you can create a navigation page and hide all the entries in that TOC.

Let me explain some basics. The terminology can be confusing because initially Kindle required a "logical TOC" (which was an HTML file linking to all the chapters) in addition to a TOC in toc.ncx The real TOC (which is machine-readable) was in toc.ncx for epub2 but inside the NAV element of the required navigation document in epub3.

In epub3 it is no longer necessary to have a toc.ncx file (and for future versions it will be deprecated). Instead you include a HTML navigation document (which you mark by using the NAV element in that file). For epub3, writers of the standards wised up; they realized that rather than requiring two different kinds of TOCs, why not just put everything in one navigation HTML document, with proper tagging and then forget about toc.ncx?

Fortunately, it is relatively easy to hide TOC entries inside the NAV element of the epub3 navigation document.

Here's how you do it in epub3. "The presence of the hidden attribute on the root indicates that the entire list is excluded from rendering in the content flow." (Source)

<div class="toc-title">Table of Contents</div>
<nav epub:type="toc">
<ol hidden="">
<li><a href="editor-preface.xhtml">Preface</a></li>
<li><a href="requiem.xhtml"> Requiem on the Rappahannock </a></li>
<li><a href="version-history.xhtml">Version History</a></li>
</ol>
</nav>
</div>

I'm not 100% sure you can hide all the entries (I haven't tested that), but I'm pretty sure you can hide almost all the entries (maybe you are required to have at least 1 visible TOC item).

If you want to hide one or more entries in epub2, edit this in package.opf.

<spine toc="ncx">
<itemref idref="cover" linear="no"/>
<itemref idref="htmltoc" linear="yes"/>
<itemref idref="alternate-toc" linear="no"/>
...

Linear="no" means to exclude it from the TOC entries for epub2 reading systems. Importantly, note that if you have an epub3 file, the reading system will probably obey the and ignore whatever you put in the package.opf file.

I am talking about epub and epub3. If I remember correctly, converting from epub3 to mobi produces the same effect.

The ability to hide TOC entries is important for certain kinds of books (the first thing that comes to mind are Choose-your-own adventure ebooks and other hypertexts).


Free books android app tbrJar TBR JAR Read Free books online gutenberg


Load Full (0)

 

Back to top