Conditional exclusion of sections from compile


I would like to be able to exclude some section types from compile in some compile templates.

For example, I might have some recurring callouts, that can only be used with a particular output format. I would therefore exclude it from an output, and replace it with a different section type.

I know this can be done with character styles, but what about if I also need another character style inside that block? For example, I could be needed a Strong style for part of the callout.

I would also be able to reuse that callout multiple times, so it would be useful to have it as a totally separate document.


Design those alternative section types and sections layouts to look as they should when included in compile. All of them, in a single compile format.
Then, cloning this compile format, uncheck everything for the section type/layout(s) you want not to compile per situation. (One compile format ready for each situation.)
Or use the master one in all situations, but first check/uncheck what to include and leave out each time. (This might turn out to be more efficient, should you want to modify the way the output looks, you wouldn’t have to redo the cloning ect.)
The blank layouts will be left out — and so the section types documents sent to go through them.


. . . . . . .

Another way would be to use the filter in the compile panel.

You could use Labels or Status as the exclusion factor. But this approach allows for only a single criteria.
Where the method above has no restriction whatsoever.

. . . . . .

You could also do it by creating a collection for each situation, and simply compile the collection – not the draft. (A document is still editable as it normally would when in a collection. You are still editing the original. And changes reflect in all collections where the document is represented.) ← I think this would be your best bet.


Clever tricks, thank you! Both can work great!


1 Like

The designed way of doing this is to use Layouts to achieve that goal, same as you would any special purpose a Type might have, with regards to the project’s relationship to the compile format that provides those layouts.

The approach is to create a “Null” Section Layout, that you can assign to any types that shouldn’t be exported. The trick is to make sure none of its checkboxes (Title, Text, Notes, etc.) are set, and that none of the Layout’s extra fields like title prefix/suffix, have any content in them.

If the compiler encounters something that prints nothing, it is designed to completely skip over it, which does have potential implications, such as not spamming a bunch of unwanted separators.

Since each Format can have its own Type/Layout bindings, this means you can easily hinge that decision upon the output format, as you desire.

1 Like