Mobileread
Can nav be a TOC?
#1  AlanHK 09-02-2019, 04:39 AM
I was working on an epub3 file.
(I know my way around epub2, but 3 I'm still stumbling.)

There wasn't a HTML contents page, and the NAV file looked OK in Sigil, so I thought I could use that.

But if I add the semantic tag "Table of contents" in Sigil, I get an error in ePubCheck:

ERROR(RSC-011): Found a reference to a resource that is not a spine item.


And when I used Calibre to view the file, the NAV file was not displayed.

I used Kindlegen to make AZW3, and it gave this error:
Warning(prcgen):W14001: Hyperlink not resolved: \OEBPS\Text\toc.xhtml
Warning(prcgen):W14002: Some hyperlinks could not be resolved.

That is certainly the location of the NAV file, as I confirmedd by opening the epub as a zip file.

However, it isn't listed in the OPF manifest section.

I gave up and copied the NAV and tagged the copy as TOC, that worked.

Can the NAV file be used as a visible Contents file or is it only an invisible system file?
Reply 

#2  jhowell 09-02-2019, 09:00 AM
An EPUB 3 navigation document is to allowed to be part of the spine of the book. From the EPUB 3 spec:

Quote
Note that the navigation document is not exclusively for machine processing. Formulating the document as an XHTML Content Document enables its reuse in the linear reading order of an EPUB Publication, avoiding the creation of additional tables of contents (i.e., it can also be added to the spine [Publications301] ).
I suspect the problem has to do with Sigil or your use of it.
Reply 

#3  Doitsu 09-02-2019, 10:32 AM
Quote jhowell
An EPUB 3 navigation document is to allowed to be part of the spine of the book.
In many commercial epub3 fiction books, the navigation document is indeed also the TOC.

However, since epub3 landmarks can only refer to spine items, it's not possible to link a TOC landmarks item to a navigation document that is not in the spine.

To test this, create a blank epub3 book with Sigil, manually delete

Code
<itemref idref="nav.xhtml" linear="no"/>
from the spine and then run EPUBCheck.

This will trigger the following error message:

Code
ERROR(RSC-011) nav.xhtml: Found a reference to a resource that is not a spine item.
Reply 

#4  AliceWonder 09-02-2019, 11:28 PM
This is why my nav.xhtml has two ToC - one that uses the 'nav' element with 'epub:type="toc"' - it has everything in spine order but has CSS property of display:none;

Then I have several (though one is enough for most use cases) 'section role="navigation"' where I have table of contents intended for the end user to see, and I don't have to worry about the ePub3 rules of them being in the spine order or what not.

Have to use 'section role="navigation"' rather than 'nav' because ePub3 expect all 'nav' nodes to specify an 'epub:type'

This gives me the visual ToC that I want for users while at same time providing a spine order ToC for eBook software to parse.

Works in every reader I tested (limited to calibre and android)
Reply 

#5  hobnail 02-25-2020, 02:41 PM
I always use the nav.xhtml file for the TOC the user sees when they page through the book. Simply open the epub in Calibre's editor and drag it to the top of the list of files (or more likely after the cover page). Doing this in Sigil (0.9.18 is what I'm using) does not work; it stays at the end of the book in the ereader.
Reply 

Today's Posts | Search this Thread | Login | Register