This is the primary control center for your ebook, where the features that effect the entire book are set, a detailed description is given, and all its content is listed. Thus, it is often named content.opf, although as mentioned it can be called anything, such as package.opf, which is fairly common, or the title of the book, such as Amazon's own Guide.opf. I find it easiest just to keep the name consistent from project to project as content.opf so that I don't have to remember what it's called when I go looking for it. You will be accessing this file many times and often throughout the creation process.
OPF stands for open packaging format, which refers to the specification that defines the structure and semantics of the package, but essentially it contains a descriptive listing of the ebook's physical contents; that is, the actual component parts included in the archive, not its literary or artistic content. It also provides some crucial information specifying how the Kindle will display your pages.
This is the first of many files where we will need to explain some things to the computer so it understands what we're saying and what to do with the information that we give it.
The OPF consists of four essential sections, given in this order:
Preceding these at the top of the page you'll see a few lines that are standard coding declarations, stating what language we're speaking (XML) and giving a namespace reference (xmlns), which is a specific set of operating rules for the reading system to follow. In Kindle ebooks currently the code is based on ePub 2.0, the standard laid out by the IDPF (the International Digital Publishing Forum), which is what this declaration specifies. You will find similar instances in the NCX and at the top of every HTML file.
The only part you need to be aware of here is the very last element, which is a "unique-identifier" that will be referenced in the metadata section below, where it will be discussed further.
The first section of the OPF is where all the metadata for your ebook lives. Metadata is "data about data," and in ebooks it provides all the information about the book itself - its title, author, publication date, etc. - which is used by libraries, retailers, search engines and other users to determine what the book is and how to catalogue it.
What you enter here will show up in databases as diverse as your local independent bookstore or the Library of Congress (or Copenhagen, or wherever it may wander in this worldwide market), as well as Amazon and every other online ebook retailer you choose to distribute to. The more metadata that you enter, the easier your ebook will be found, and moreover, found by the readers who would most want to read it.
In addition to the standard ePub metadata that defines the ebook content, Amazon has added its own set of data attributes that determine several overarching functions of the ebook that make the Kindle fixed layout format unique. These function for the most part as on/off switches for various features, although a few have unique values that will be explained in detail as we come to them.
Before we get to the metadata proper, however, we must declare our data reference systems, of which we'll be using two. These you will find on the first line of the metadata section:
The first of these, Dublin Core (dc), has provided the primary set of fifteen metadata elements in use in ebooks for some time; but the second, slightly newer Open Packaging Format (opf) set, from the IDPF's own ePub spec, adds some specifics to these that are useful for fine-tuning our statements, so we declare both here.
The general practice is to state the dc element followed by an opf extension (if desired), such as this example for an ISBN:
where the generic Dublin Core identifier is defined by the opf:scheme modifier as an ISBN. The actual data is entered between the angle brackets: here as ISBN#, which you would, of course replace with your own information, as will be the case for each metadata entry in the general metadata section (Amazon's Kindle-specific system is slightly different).
Technically, no OPF modifiers are required, but their use provides considerably more information, as you can see. And while not all ebooks will include both, I have included them here for your reference, so that you can use them if you choose.
<!-- A Note Concerning Comments -->Any text you see entered between angle brackets and dashes with an exclamation point in front - such as those around the header above this paragraph - is comment text, and is disregarded by the operating system. It can consequently be deleted or altered at your discretion. It is used to pass along useful notes or help to organize the content. In the templates it is used it to create sections and sub-sections of a file's markup - the computer code that defines its stucture and contents - and to point out important elements.
You will also find a similar convention in the CSS files, where forward slashes and asterisks are used instead, like so:
/* comment */
In CSS files the comment text will generally also turn green in the file editor, which is even more helpful for separating it out from surrounding code. Here in the OPF, however, everything is black and white.
Any of these notes can be deleted or altered at your discretion, as they have no functional effect on the file. Just be sure to delete both angle brackets and everything in between!