Exporting website from TBX

Two questions:

  1. Is there a way to set only one parent folder for export to HTML? I want to have a note called “Website” inside a TBX file that has many notes, but only export that folder and its children and nothing else.

  2. Is there a way to extend an HTML template? I currently have three templates: base, page and index. I want to set base to hold the basic structure of the HTML but then have page and index extend it. I looked at the export codes that @mwra documented and tried using include(), but didn’t quite get it setup.

#1 Yes. Look at $HTMLDontExport, which exports (or not) the current note (Default=false, so things export) and $HTMLExportChildren which controls if the current note’s children, and thus descendants, are exporting (Default=true, so things export). By default settings, a TBX exports everythnig. But let’s say you’ve 5 root containers and only one is to export content to HTML. Set the other four to:

$HTMLDontExport=true; $HTMLExportChildren=false;

and now those 4 and their descendants won’t export as part of file-level export.

#2 Yes, but conceptual examples get complex. Better to post an example of a template and the template you want to use within it. Even better in a simple TBX (which you can upload here) as that also reveals which note (is expected to use) which template). As you’ve seen, Tinderbox’s export is very flexible if arcane at the extremes (depths I have plumbed!.

Thanks @mwra! #1 was fixed for me. Regarding #2: I’m actually a programmer by trade --and generally thrive in complexity. Could you just direct me to the appropriate method(s) that handle that sort of thing? Thanks!

Good. Apologies if you’ve already looked at these, but a few links in my refs and demos:

  • A set of primers on the general forms of HTML export: all vs. some, envelope+sheets recursion, other forms of include. Here.
  • In aTbRef:
  • The aTbRef TBX, used to make the above website. Some, features to look at, most of which are non-exporting root containers:
    • Templates. There are many, but colour coded. Green are the key ones. Dark blue are helper subsidiary templates. Orange are for feeds (RSS etc.) and purple for making the Zip of the TBX and images. `5-basic_all’ does >90% of the pages (the ‘5’ just denotes when I upgraded to using HTML 5). ‘5-sitemap’ is a wrapper that uses a single template ‘5-sitemap-item’ to outline the whole site’s outline. And so on…
    • Boilerplate. This is from whence most of the include code seen in the main template comes.

Personally, I don’t embed images and not just for TBX size. I like to have more control over image type/compression. aTbRef is set up to hold 0 or 1 images per note (info in attributes), that worked 10 years back and I stuck with it out of laziness but there are more options now if starting afresh. As you’ll see from the templates, the old method does compile the page differently depending on the portrait/landscape orientation. Part of this was done to assist with making a dynamic format so that you may read the website on a phone.

Anyway, there are some pointers. The deeper stuff is best explored with more of a framework, i.e. a task to undertake. As you begin to nest and include (transclude!) more you’ll need to take extra care over nuance between ‘this’, ‘current’ and ‘that’.

I hope that helps…