Join Rufus Deuchler for an in-depth discussion in this video Fixing the hyperlink bug in InDesign CS5, part of Creating Ebooks with InDesign CS5.
Let's now see how to fix the hyperlink bug for footnotes and cross-references. And that goes for InDesign CS5 version 7.0.3. So, if you have a more recent version than that, please check before you actually go through the pain of doing this. Footnotes and cross-references are very important part of an eBook because they allow for faster navigation from a footnote number to its text and maybe from one section of the eBook to another. Unfortunately, there is this really nasty bug in InDesign which prevents these hyperlinks from working, especially when we divide a single InDesign document in several XHTML files.
So, what exactly is the problem? You see, if I click on these links, which I've created as cross-references inside of InDesign, nothing works. I'm not going to the correct pages. So, to understand what actually happens here, we need to go into the Code view. The Code view will allow us to see exactly what the problem is. You see that right now, we are in a file called textxhtml and this is where we have our table of contents.
The problem is that InDesign was thinking it was all inside of the same document. So, basically, what it did it simply put the name of the text anchor without specifying the file that this text anchor is in. And the way to solve this problem is to actually insert manually the name of the file. In this case, this is the Chapter 1 title, we need to insert text, a little hyphen number 1.xhtml, all right, right before the anchor name, okay, because this is the correct way to actually define the link.
So, I'm going to do that to all of the links because it is very important that these hyperlinks actually work. It's not only important that they work and here, I'm going to do the number 2 chapter and here as well, and as I go along, I will explain exactly why this is important. Because many eBook devices or eBook publishing systems will actually not let you publish an ePub with faulty links because they will report back to you and say, no, no, there's errors in the links, you can't actually publish the ePub as is.
So, this is why we need to painstakingly go into our code here and actually replace those hyperlinks, oh, that's still number 4 by hand, okay? So, this is going to be rather boring, we're going to Chapter 5 here, and then again to Chapter 5, this is the underlying text like this. And then, maybe we can add another one here for Chapter 6. Then I will also show you a way that you can actually do this automatically avoiding the whole problem. But it was important for me to show you that you can actually do it manually if you have just a simple table of contents like I have here. And maybe if you have a kind of footnotes and cross-references all across your book, you may want to find out about the other solution I'm going to talk about. So here, we're at number 9 and I'm going to put at here for the last anchor. Here, we go to 9 and 9 again.
All right. So, at that point ,all my hyperlinks should be fixed. So, if we go back to the Book view here, if I press on Chapter 4, boom, we indeed go to Chapter 4. So now, my hyperlinks actually do work. Now, there is a system that I wanted to show you and here, I'm going over to Safari to present to you the website of Teus de Jong, a developer from Holland, and, who actually created a script that can help you get rid of that problem. If you go to his homepage, which is at www.teusdejong.nl, the Netherlands. Inside of the InDesign utilities, if you move down at the bottom of the page, you will see that there is a script for the correction of links in ePubs made with InDesign CS5.
So right now, this problem is still actual, so here, you can find a solution. Teus here explains exactly where you need to install these scripts, and then, you can run the ePub export directly just simply using his script. So, to close this theme about the problem that we find in these hyperlinks, my advice to you is as long as the problem is not really solved, and if you need to work with hyperlinks and cross-references and footnotes inside of your documents, either use Teus' script, or try to use them as little as possible, because the manual workaround is a really, really painful one.
- Creating a new InDesign document with EPUB in mind
- Working with text
- Creating hyperlinks and cross-references
- Working with graphics
- Defining the reading order of the EPUB
- Other essential parts of an ebook
- Exporting to EPUB
- Customizing an EPUB