The OPF file is located within the OPS folder. ‘OPF’ stands for Open Package Format. It’s essentially an XML file, although it has the file extension .opf instead of .xml. It lists all of the contents of your ePUB, and tells the reading system what order to display the files in.
There are five parts to the OPF:
1. The XML doctype
The first line of the doctype tells the machine that is reading the file that it is in XML, and the second tells it where to go to find the rules of this particular type of XML (the OPF standard on the IDPF website).
The unique identifier in the OPF must match the unique identifier in the metadata below. You can use the ISBN of the book that you are creating as the identifier, or you can use the generic “book-id”.
2. The Metadata
This section contains the basic metadata about the book. It is different from the metadata that you send via ONIX feed, or fill out in an Excel template. This section within the ePUB just contains some very basic information. The only five lines that you really need in the metadata are the title, publication date, book-id, language and the date the file was last modified.
3. The OPF Manifest
The manifest is an unordered list of all of the files within the OEBPS/OPS directory. Each item in the manifest has three components
- An item ID, which you can make up, and should describe the file.
2. A reference to the actual file.
3. The media-type, which tells the parser what type of file it is.
Things that should be included in the manifest:
- All of the XHTML pages in the book (introduction, copyright, chapters, epigraph, etc.)
- Audio or Video files, if applicable
- The CSS stylesheet
- The NCX file, if you’re working with the ePUB 2.0 format
You can leave out the OPF itself, the META-INF, and the mimetype.
Here is an example of a manifest:
4. The Spine
The spine is an ordered list of all of the contents of the book. It uses the item IDs you’ve created in the manifest. Each item gets an item ref, and you use the item id that you created in the manifest for the id ref.
Here’s an example of a spine:
5. The Guide
The guide points the reading system to the main content in the book. Typically, the guide includes the cover, the table of contents, and the beginning of the actual text. The guide section is deprecated in ePUB 3.0, but some vendors still use it.