How Can I Excerpt the Root Page from the EPUB Export?

Question

How can I excerpt the root page from the  EPUB export?

Answer

If you want to use a page to set the scope of what pages will be included in your export but you do not want to include that page in the export please do the following:

E.g. If you want to include pages from all over the Space, you have to start the export from the root page of the Space.

  1. Create your own EPUB export template.
  2. Adapt the files toc.ncx.vm, resources.opf.vm and atlassian-plugin.xml. Remove the entries for the root page in those files. That will effectively exclude the root page from the Ebook structure even if a HTML file is still generated for it and included in the EPUB file.
    (info) If there is content on that page that is not supposed to be exported, place into a Scroll-ignore macro.
  3. Adapt the example template as follows:
    • toc.ncx.vm (toc.ncx.vm on Bitbucket)
      1. Remove lines 37 to 47 (including those).
      2. Instead insert the following code: 

        #set($playOrder = 0) 
        #foreach($child in $context.sourceTree.children) 
        #set($playOrder = $playOrder + 1) 
        #epubToc($child) 
        #end
    • resources.opf.vm (resources.opf.vm on Bitbucket).
      • Remove lines 39 and 61.
    • atlassian-plugin.xml (atlassian-plugin.xml on Bitbucket).
      • Insert the following code as last entry in the <scroll-template> element (between lines 72 and 73):

        <resource type="static-resource" name="resources.opf" location="template/resources.opf.vm"> 
        <param name="needsRendering">true</param> 
        </resource> 
        <resource type="static-resource" name="toc.ncx" location="template/toc.ncx.vm"> 
        <param name="needsRendering">true</param> 
        </resource>

        This will ensure that your modified files will be used instead of the defaults that are bundled with the exporter.

The filename of the EPUB file is still based on the root page title. This cannot be changed so far, but you can easily rename it.

Attachments

The attached files are the edited versions of the toc.ncx.vm, resources.opf.vm and atlassian-plugin.xml.