Creating Arbitrary EPUB OPF Metadata

The OPF package manifest within an EPUB document can contain metadata entries. The entries required for EPUB validation are created automatically by the EPUB generation process. However, you may want or need to add additional metadata, for example to support the conventions of a particular EPUB reader.

You can create arbitrary OPF metadata entries by creating a <data> element in your map's metadata with the name "opf-metadata". Use child <data> elements to define specific metadata items, where the @name value is is used as the @name attribute on the OPF <meta> and the @@value or content of the <data> element is used as the @content attribute on the OPF <meta> element.

For example, this markup in a DITA map:
<map>
 <topicmeta>
  <data name="opf-metadata">
    <data name="item-one" value="value one"/>
    <data name="item-two" value="value two"/>
  </data>
 </topicmeta>
</map>
Would result in OPF metadata like this:
   ...
   <metadata>
      <dc:title>DITA For Publishers User Guide</dc:title>
      <dc:language id="language">en-US</dc:language>
      <dc:identifier id="bookid">http://example.org/epubs/</dc:identifier>
      <dc:creator opf:role="aut">W. Eliot Kimber</dc:creator>
      <meta name="item-one" content="value one"/>
      <meta name="item-two" content="value two"/>
   </metadata>
   ...