Fixed unique ID generation for ebooks.

This also solves #89 issue without the need to "refresh" Twig global variables.