In The Global Indie Author, I illustrate how to make an ePub with InDesign CS5, and indicate there are only a few bugs to fix: the defective date code and the inability to embed fonts. Having now converted the more complex book design of The Indie Global Author, which makes use of dozens of external and internal hyperlinks, I have two more bugs to report: all internal hyperlinks will be missing their location code; and external hyperlinks that contain an ampersand (“&”) cause InDesign to stop parsing the file; any content that succeeds the offending link will be missing from the ensuing ePub. Moreover, since it appears that InDesign creates the TOC at the end of the conversion process, entries from the TOC that are related to the file will also be missing. If you are working from a book document, this will present itself as a botched TOC where one chapter will be fine while another will not. If you are working from a single document, the ePub will fail to export and InDesign will crash.
The way around this latter problem is simple: wherever there is an ampersand in the hyperlink, you must amend the hyperlink in the Hyperlink Options to change any ampersands from “&” to “&”. I also noticed that “https” caused issues, and since websites will redirect users from “http” to “https”, the necessary amendment will not affect the hyperlink. For example (the offending code is in red for emphasis only):
https://kdp.amazon.com/self-publishing/signin?ie=UTF8&ld=AZEbooksMakeM
needs to be changed to
http://kdp.amazon.com/self-publishing/signin?ie=UTF8&ld=AZEbooksMakeM
Note that the text can be as originally written; it is only the hyperlink information itself that must be amended.
A HUGE thank you to John Schember, lead developer of Sigil, for figuring this one out for me after I sent him a list of five offending hyperlinks that were causing me grief. I would never in a million years have figured out the culprit was an ampersand — I am not a programmer; I’m an author who out of necessity learned some basic HTML. It also does not help that InDesign does not report the offense to the user — no warning comes up indicating the hyperlink is invalid — so unless you notice, as I did, a suspicious correlation between missing hyperlinks and a failed TOC, you may never figure out what is going wrong.
The second bug is a lot more tedious to fix. During the exportation to ePub, when InDesign CS5 generates hyperlinks it remembers to put in the name of the anchor but not its location, that is, the name of the xhtml file where the anchor is located. For example
<span><a href=”#x34-anchor”>34</a></span>
is missing the location of “#x34 anchor”, which in this case is located in the xhtml file called “Endnotes.xhtml”. The result is a hyperlink that goes nowhere. In order for the hyperlink to work, after exporting to ePub you must edit the code to add the location:
<span><a href=”Endnotes.xhtml#x34-anchor”>34</a></span>
As you can imagine, this will be time-consuming if you have a lot of internal links.
Adobe claim to have fixed this in InDesign 5.5, but on at least one forum some users deny this is so. I am awaiting my upgrade to CS5.5; when I receive it I’ll test it and let you know the outcome. In the meantime, you can edit your ePub files using the free Sigil, or in a combination of tweak_epub and Notepad (TextEdit on the Mac), or in any other XHTML editor of your choice.