The variable $context is used in the default Scroll HTML Exporter theme. This documentation explains how to use that variable for your own themes.

We put a couple of Objects there get information about the export process.

objecttypeusagenoteproperties/methods/value
ExportModeStringThis is mostly here to determine the display method.
If all contents are in one page, you need to have another means of navigation, than for a single html page.

Contains selected option for General>Create

  • default for "one HTML file for each Confluence page"
  • single-page for "a single large HTML file"
ConfigurationProperties    
SourceTree.ChildrenArray[Page]

You recursively loop through all pages and their children.
Example: 

#foreach($child in $context.SourceTree.Children)
    $child.displayTitle
#end
CODE
This is the tree of pages generated
  • children - a list of all children pages
  • DisplayTitle - Title of that page
  • Id - ID of the page
WorkDirectoryFileContains information about the File. All available methods and properties are available in the Java docs for java.io.File.  
LinkNamingStrategyObject

This is used to determine which href to use when linking to another page.
Example: $context.getLinkNamingStrategy().generateLinkString($page)
where page  

  
CombinedSectionLevelNumberUsed for rendering the section override  
BuildSearchIndexBooleantrue or false  


Depending on choices made in the export configuration, we can determine if a section of a template would be able to be displayed or not.