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 follow the steps below. If you want to include pages from all over the Space, you have to start the export from the root page of the Space.
- Create your own EPUB export template.
- 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.
If there is content on that page that is not supposed to be exported, place into a Scroll-ignore macro. - Adapt the example template as follows:
- toc.ncx.vm (toc.ncx.vm on Bitbucket)
- Remove lines 37 to 47 (including those).
Instead insert the following code:
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):
CODE<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.
- toc.ncx.vm (toc.ncx.vm on Bitbucket)