What’s in an ePUB?: The Root Directory

The ePUB3 Package

When you first unzip an ePUB, you’ll see two folders and a file in the root directory: the mimetype, the META-INF and the OPS.

ePUB3 Package Root

Let’s take a look at each of those items.

1. The Mimetype

This file consists of one line of text:

mimetype

To create a mimetype, you simply type that line of text into a Text editor.  This file explains to the computer that the archive is an ePUB, and needs to be read using an engine that can handle ePUBs. It must be the first file added to your ePUB folder when you are creating a new ePUB. Some scripts and programs will automatically place it first, but on a PC, if you are zipping manually, you need to make sure to drop it into the ePUB folder first.

It doesn’t have a file extension; it should just be named mimetype.

2. The META-INF Folder

Inside the META-INF folder is an XML file called container.xml that points the ebook to the OPF file.

META-INF

Here is what is typically in the container.xml file:

META-INF

This is the XML file that describes the ebook. You don’t really need to change anything in this code, you should be able to copy and paste it for every ebook you create. Sometimes, the directory is called an OPS rather than OEBPS.  If that’s the case, then you need change it to OPS in the <rootfile> element too.

3. The OPS Folder

This is where all of the content of your ebook lives.

OPS

Typically, each chapter in the book will have its own HTML or XHTML page, as will any ancillary materials like the copyright page, title page, preface, epigraph, etc.

Different types of media need their own folders, so you should create a folder to house all of the images contained within the book, and another for fonts, and one for the CSS. If your book has any audio/video materials, those would need their own folders, too.

 Next up: The OPF File!