The Tree of Widsdom

智慧の樹

Brief analysis of bstMainPage


bstMainPage is the default template file for BoxPress. The template that a note uses during export is determined by the value of its $HTMLTemplateFile attribute. BoxPress has been set up to export every page in your website with the bstMainPage template. Unless you set the value of $HTMLTemplateFile to something else, the default value of the $HTMLTemplateFile system attribute will be the one found in the local file Preferences. This has already been set for you.

How to set the default template in TB5
To set the default template for your whole TBX, hit ⌘8 to open the local file Preferences, click the HTML tab, and set the “HTML template file” field.
How to set the default template in TB6
To set the default template for your whole TBX, go to Document Inspector > System > HTML > HTMLExportTemplate and enter the path of your preferred template note in the “Default” field.

An individual note’s $HTMLTemplateFile can be changed in various ways:

  • In the Get Info window: ⌥⌘I
  • In the HTML Inspector
  • Using an agent
  • Using a rule

What does the bstMainPage template do?

  • It inserts some boilerplate.
  • It checks to see if the post has an HTML imagemap and, if so, inserts the appropriate boilerplate.
  • It lays out a responsive .container div and a .row that can be treated as a 12-column grid (features inherited from the Bootstrap framework).
  • It lays out the HTML5 main element, and gives the left 8 columns to your main content.
  • It makes queries about the target note. Is it our BlogTopNote? Is it the BlogAboutNote? It is the Categories agent? It is the Archives agent? Is it one of your category container notes? Is it the PAGES container note? If so, then do something special. If not, then assume that it’s a post and include the note using the bstPost template.
  • It closes the 8-column main element.
  • It inserts more boilerplate—bsbSidebar.
  • It closes the .container div and the .row main elements.
  • It inserts the final bit of boilerplate—bsbBottom.