What is an ePub file? Why won’t it validate when I make one in inDesign?

Yesterday an email dropped into my inbox and I found myself doing some impromptu ePub troubleshooting on an ePub that wouldn’t validate. The ePub had been exported through inDesign – I don’t know which version at the moment.

Now – inDesign is a great conversion tool – but unless you get everything set up right it’s unlikely that your ePub will validate without cracking it open and making some tweaks. In fact – it’s unlikely that it will validate straight from InDesign whatever you do. It’s just a question of how much you do in inDesign.

So I exported one of my test files with some deliberate errors to see what I landed up with. Oh dear.

Validation errors

Validation errors

A while back I wrote a post on what an e-book ‘file’ is. I mentioned that an ePub file isn’t a single file at all, but a zipped-up collection of files. Screen shot below.

unzipped ePub

unzipped ePub

Just to recap: the xhtml files are the content of the book. It’s a good idea to set them up as one file per chapter.

split screen

split screen

This is a split-screen view in Dreamweaver. The xhtml on left and how it should look on the right.

The toc.ncx file contains the table of contents.

Table of contents

Table of contents

The css file deals with how the text is styled. This can be a world of pain, but doesn’t tend to stop your file validating.

The content.opf file is the one you really want to check out if your file won’t validate.

Content.opf file

Content.opf file

Notice that there are a whole load of metadata fields that begin with <dc:. You are likely to have validation problems if your title, date, language and identifier fields aren’t filled in. The title is the main one. E-readers often run the title across the top or bottom of the screen and it’s pulled in from here. InDesign should pull these in during the export – but only if it’s set up to. The title field (and some others) is dragged in from ‘File Info’ in inDesign – it’s NOT the file name. I know from working in print for ages that we rarely fill in the file info box for print, or if we’ve used files as templates they might contain old info. So that’s one to get into the habit of filling in.

The next section is the manifest. This is a packing list of everything that’s in the ePub folder. If anything is listed here it must be in the folder. Everything in the folder must be listed here. File names and file types must match, or your file may not validate.

The Spine lists the order that the files will appear. Again, if there are any mismatches your file might not validate.

Finally there is an optional section called the Guide. This isn’t created by inDesign at the moment. You will have to go in and create it manually. It seems to be more of an issue if you want to convert to Kindle format. It shows the Kindle software where the cover, table of contents and the start of the text is located. It won’t stop your ePub validating, but if you convert to Kindle format it may throw up an error if it’s not there.

content.opf file. Spine and guide

content.opf file. Spine and guide

And finally don’t have spaces in file names – EVER. It’s a good idea to get into the habit of just using letters and numbers for any files you create. You’ll notice that the majority of warnings in the first image above are down to my inDesign file name containing spaces.

And remember – validation is only the beginning – you can have a file that validates perfectly, but it can still be riddled with formatting errors that will cause it to give poor user experience.

Advertisements
Tagged , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: