Expert publishing blog opinions are solely those of the blogger and not necessarily endorsed by DBW.
Navigation is an important part of every ebook file, and one navigation option that many publishers often forget when creating their ebooks is page numbers.
“Wait… There are page numbers in ebooks?” you might ask. Yes! Page numbers are actually very useful for ebook files and can be a helpful addition to navigating the content. While it’s true that many devices display automatically-created page numbers in ebooks, these numbers are actually disconnected from the print book and can be confusing to readers.
Print page numbers are very useful to readers, though. For example, imagine you are sitting in a book club with your iPad, and someone wants to talk about a paragraph on page 193. How would you get there? Well, you might lean over to the person sitting next to you to find out what chapter that page is in, or try to get enough context from the conversation to use the search feature in your reading app. However, if you simply had page number navigation you would already be there.
In addition to books used in book clubs, textbooks and other ebooks that may be used by students and teachers would benefit from having page numbers, as well. Ebooks with indexes are also a good use case, since you are normally going to be linking the page numbers in the index back into the book. You do link your index page numbers, right?
“Okay, you convinced me,” you say. (Wow! That was easier than I thought!) “So how do I create these page numbers you mention?”
Step 1: Add page numbers to the HTML
This is actually the hardest part of the process. In EPUB 3, page numbers within the text are tagged with span tags that look like this:
This span tag includes the epub:type attribute for semantic inflection, as well as an id that can be used for linking, and the title, which contains the actual page number value. These tags have to be added to the HTML of your book, located in the text wherever your print page number begins. For example, if a new chapter starts at the top of page 193, then you would place the span tag inside the heading or section element, like this:
If page 193 starts in the middle of a paragraph, you would place the span tag in between the words that split across the page break. If you have one word breaking across pages with a hyphen, I recommend placing the span tag after the word, not in the middle of it. Note that the <span> tag is an inline element, and it must be placed inside a block element like a paragraph, heading, section or div.
If you add your page numbers manually, it will probably take a long time. I recommend you put on your favorite audiobook or TV show and get going.
Of course, you could also try exporting the page numbers from InDesign. While InDesign does not do this on its own yet, some ebook developers have hacked together some methods that make it possible. Laura Brady explained one method during her workshop at PePcon this year.
Step 2: Add the page-list
Once you have the page numbers added, you need to create your page-list. In EPUB 3, the page-list is a section in your Nav Doc (Table of Contents) file. The code for this section is very simple, following the pattern below:
The page list is pretty easy to create when you know how to use regular expressions, but you can also do it manually if necessary. Note that the links must be in the same order as the span tags within the EPUB.
Step 3: Add the source to your metadata
Now that your page numbers are included in the EPUB, be sure to note in the metadata what book those page numbers come from. This is done with the <dc:source> attribute, like this:
That’s it! As you can see, adding page numbers can be a big job, but it provides readers with more navigation options and allows you to add more features like linked indexes. Note that iBooks is the only reading system that currently supports the page-list functionality and actually shows the reader the print page numbers visibly. However, I fully expect other retailers to add support for it in the future, and even without the visible page numbers you can still reap the benefits of a linked index in every reading system.
Do you have a question about EPUB creation? Want examples of how to do more tasks like this? Leave a comment below and I’ll add it to my list of future blog posts!
To get all the ebook and digital publishing news you need every day in your inbox at 8:00 AM, sign up for the DBW Daily today!