Step-by-step guide: How to setup conditional content generation
By default, the content of each topic is included in all builds when the documentation is generated. HelpNDoc gives you the option of defining rules to include selected sections of topics in specific outputs.
Defining these rules is simple; you don’t need to be a programmer. HelpNDoc provides a user-friendly way to define and insert the rules. The rules contain ‘If,’ ‘Else,’ and ‘End’ logic statements that outline the conditions for including specific sections in selected builds. HelpNDoc uses these instructions when generating documentation.
To begin, place your cursor at the location within the topic where you’d like to insert the rule.
This opens the ‘Insert conditional operation’ window.
You’ll use this window to define the conditions to instruct HelpNDoc whether to include sections of the topic in outputs when publishing documentation.
Condition: You begin by inserting either an ‘If’ or ‘If not’ statement.
- IF: inserts the build tags selected
- IF NOT: excludes the build tags selected
Current build tags include: Click the box for each appropriate build tag. This displays a check mark, indicating the tag is active. Click a check mark to deactivate the tag.
Click OK to save the rule and close the window.
This returns you to the topic editor where the ‘If’ or ‘If not’ rule you defined above is displayed.
Place your cursor below the end of the section that should be included in that rule.
Click Insert/Edit condition again to display the ‘Insert Conditional Operation’ window.
Next, you have the option to insert an ‘Else’ statement to create an additional condition.
When you insert an ‘Else’ rule, this negates the previous ‘If’ or ‘If not’ rule for the selected section.
For example, if the ‘If’ rule applies only to the first version of your product, you could define an ‘Else’ rule that applies to all other versions of the product.
Click Else and then click OK to close the window.
This displays the ‘Else’ rule in your topic editor.
Lastly, you’ll complete the rule(s).
To do this, place your cursor below the end of the section included in the rule(s) defined above. (You do this regardless of whether you defined an ‘Else’ rule above.)
Click Insert/Edit condition again to access the ‘Insert conditional operation’ window.
Click End and then click OK to save the rule and close the window.
All content following ‘End’ is included in all outputs.
If only one condition applies, an ‘Else’ statement is not required. Instead, you’ll insert only an ‘If’ (or ‘If not’) rule and an ‘End’ statement.
To edit existing conditional content generation rules, highlight the rule that you’d like to update. Then, click Insert/Edit condition to access the ‘Insert conditional operation’ window. Then, follow the steps outlined above to update the selected rule.
By defining conditional content generation within your topics, you can easily generate multiple variations of your documentation for various clients, licenses, version, kinds of users… In addition to conditional topic generation, HelpNDoc provides a great flexibility in generating multiple versions of the same documentation.