View Full Version : How to properly format links so they validate and work, too?


justbobf
07-11-2010, 11:51 PM
I created a book in Adobe InDesign and exported it as an ePub.

I opened the ePub with Springy. (BTW, I'm on a Mac.) Each chapter was exported as a separate .xhtml file in the ePub. I had created a separate chapter for the Table of Content. I opened that file, which is the name-of-the-book-5.xhtml and I manually added links to the chapter names. The links looked like this:

<a href="name-of-the-book-1.xhtml">Chapter number</a>

This ePub validates with epubcheck-1.0.5. Trouble is, when put on the iPod, the links do not work.

So I added ../ to the links to make the iPod look in another file. The links now looks like this:


<a href="../name-of-the-book-1.xhtml">Chapter number</a>

Loaded this onto the iPod. Bingo! Links work. Trouble is, now the file does not pass the validation test.

Ideas?

hkdorama
07-12-2010, 11:05 AM
<a href="name-of-the-book-1.xhtml">Chapter number</a>

Have you tried opening the file in Safari to see whether the link works there?

justbobf
07-12-2010, 03:52 PM
Excellent suggestion!

Yes, the file with the traditional internet links, without the "../", and the one that validates does link properly. The file with the "../" added does not.

But! the first time I tried this Safari reported that I did not have "permissions" to view the page.

I went back to the Finder and re-set Permissions so that I could Read & Write to all the files in the ePub. Then, the linked page would load.

So, could it be that the file permissions are being carried over to the iPod Touch? That might prevent the link from opening then, just as Safari would not open the link. Or, do permissions get dropped if the file is transferred to another computer? If I need to set permissions here, any idea what they would be? I can guess what the permissions would be, but what would the name be? "everyone", "system", "staff"? Any ideas?

hkdorama
07-12-2010, 04:30 PM
Could it be you took some files and then adjusted them for your book? Maybe somebody else's permissions were carried over with the files. Usually you do not have to deal with the permissions at all. The normal ones would be read and write for you and read only for others...

Jellby
07-13-2010, 05:20 AM
What is the directory structure inside the ePUB? Do you have a <base> tag or similar? Can we see a full (non-)working example?

It should work if you have a structure like this:


mimetype
META-INF
container.xml
OEBPS
content.opf
TableOfContents.xhtml
Chapter-1.xhtml
Chapter-2.xhtml
...

and, inside "TableOfContents.xhtml" there's a link like:

<a href="Chapter-1.xhtml">Chapter One</a>

that's because "TableOfContents.xhtml" and "Chapter-1.xhtml" are in the same directory. By the way, "TableOfContents.xhtml" is included in the OPF file, right?

justbobf
07-15-2010, 08:57 PM
Hello everyone.

Thank you all for your help.

Yes, the traditional links do work:

<a href="Chapter-1.xhtml">Chapter One</a>

I do not need the "../" in the link. Don't know what happened before. Maybe it is because I transferred the file to another user on my computer before loading it onto my iPod Touch. I don't have that iPod right now, so I cannot confirm that that is a problem; but, the epub does work as expected on a friend's iPhone and it does validate as expected with epubcheck-1.0.5.

So, I don't know what went wrong before, but all is fine, now. Thank you all, again. Your responses told me what to look for when trouble-shooting the files.

Oh! BTW, I opened Winnie-The-Pooh and found all permissions were set as
everyone: no access. If I edit a file by extracting it with Springy, I have to set it to
everyone: Read & Write
or else Springy won't let me overwrite the old file when I replace it with the new one, for what that is worth.