I've been using the Perl module EBook::EPUB to create ebooks to read in iBooks. But I can't figure out how to set a category for the books I create. When I sort by categories in iBooks, it doesn't seem to do anything. As I understand it, that should show each category as a heading with those books listed underneath it. But it seems my books don't have categories.

How do I set a category when creating an EPUB book?

  • The question is where does iBooks read the category from - is it metadata held only in iBooks in which case @EelcoDeulingor's answer is a start or is is it a field in the epub file
    – mmmmmm
    Commented Jul 5, 2013 at 18:39
  • I'm assuming there's some optional field in the EPUB that specifies the category (or at least the default category). If not, I'll probably just give up on using categories. I don't want to have to fire up iTunes every time I transfer a book to my iPad.
    – cjm
    Commented Jul 5, 2013 at 18:48
  • it might be worth asking on the new site ebooks.stackexchange.com as there will be more people knowing ePub and hopefully iBooks
    – mmmmmm
    Commented Feb 25, 2014 at 20:01

3 Answers 3


You can set the category in iTunes, using the info window (Cmd - i). No need to use Calibre.

  • 2
    I don't want to have to fix it after the fact. I'd like the EPUB to specify the category automatically.
    – cjm
    Commented Jul 5, 2013 at 14:24
  • There is a difference between Fixing and Creating :)
    – Ruskes
    Commented Jul 5, 2013 at 17:00
  • There is no way iTunes can "guess" metadata: you have to put it somewhere in the ePub file.
    – user52694
    Commented Jul 6, 2013 at 6:47
  • 2
    For music iTunes uses the Gracenote database, but there is no such thing for books (although it could use the ISBN information). Your Perl script puts the 4 required Dublin Core data types in tje ePub file: there are more types available, but not all are used by iTunes. iTunes uses a special (not ePub standard) file within the ePub: the iTunesMetadata.plist. The genre is set in this xml file as a string element. It is possible to script this, but it is much easier to use iTunes.
    – user52694
    Commented Jul 6, 2013 at 6:58

and the mighty Google said:

The ePub eBooks Metadata Mess!

Basically you will need a Software called Calibre to set the metadata on eBooks to be able to sort them by category.

Yes, it is FREE !

Here is a SAMPLE.

enter image description here

Next step:

Getting eBooks from Calibre to Your Device Using Send to Device and the Connect/Share Functions.

A special plugboard that you may want to create is a “genre” plugboard that corresponds with a “genre” or “tag” field.

Using this in conjunction with iBooks can sort your books into separate categories on your iOS device.

First, create a custom field that you will want to use to sort your iBooks. You may generically name it “genre” in case you want to use it for some other purpose otherwise you could name it “ibooks_cat” or something like that. For column type, select “Text, column show in the tag browser.” As with any new column, you will have to restart calibre. Go through and mark the books in your library. Alternatively, you can use the existing “tag” field. Then create a new plugboard: Format=epub | Device=apple | Source template {#usercolumn} or {tags} | Destination field=tags. Save and then “Apply”.

  • Where in Calibre does it set category? There is no such field in it.
    – mmmmmm
    Commented Jul 5, 2013 at 9:00
  • From that article, it's not quite clear whether changing metadata in Calibre has an effect in iBooks. I suppose I'll have to install it and experiment. But this doesn't answer my real question, which is "How does Calibre store the category in the EPUB?"
    – cjm
    Commented Jul 5, 2013 at 14:26
  • See my update above. I think Calibre is very powerful and allows you high customization. So try it. This also goes for @Mark
    – Ruskes
    Commented Jul 5, 2013 at 16:58
  • @Buscar웃 I use Calibre but do these categories that you add match to iBooks categories
    – mmmmmm
    Commented Jul 5, 2013 at 18:27
  • 2
    Besides, unfortunately Calibre is the ugliest software I ever had to use.
    – bot47
    Commented Feb 25, 2014 at 4:47

The article that @Buscar's answer points to says that the tags field in calibre maps to the Categories in iBooks.

Looking at an example in my calibre db this looks like each tag shown in calibre map to a <dc:subject> element in the .opf file in the epub.

e.g. a Tag of Fiction maps to <dc:subject>Fiction</dc:subject>

This element is at the end of the metadata element in the root package element.

So I think you need to call the add_subject method on EBook::EPUB

Looking at the article it suggests that iBooks reads only one of the tags, which then comparing with the epub spec suggests that iBooks is doing it wrongly. A workround might be to make sure that there is only one subject element in the epub

  • Actually, there's an add_subject method that adds a <dc:subject> tag, but that doesn't seem to have any effect on iBooks.
    – cjm
    Commented Jul 5, 2013 at 20:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .