Conditional content
Conditional content means you can include or exclude content depending on certain conditions. For example:
Audience level
Product
Version
Platform or operating system
Output type
In Writerside, you can use filters to specify whether a specific element, like a paragraph, a code snippet, or a screenshot, should or should not be included in a particular version of the documentation. All elements without the filter
attribute are included implicitly.
Filter by instance
If you want to filter the content by the instance, add the
instance
attribute to the tag and specify the instance IDs where the content should be displayed. To exclude the element from a particular instance help, add!
with an instance ID. You can add theif
tag to select specific portions of content that do not match tags.<chapter title="Go to Declaration"/> <p> Place the caret at the desired symbol and press <shortcut key="GoTo"/>. </p> <p instance="ab,cd"> Alternatively, keeping <if instance="ab"> <shortcut>Ctrl</shortcut> (<shortcut>⌘</shortcut> for macOS) </if> <if instance="cd"> <shortcut>⌘</shortcut> </if> pressed, hover your mouse pointer over the symbol. </p>## Go to Declaration Place the caret at the desired symbol and press <shortcut key="GoTo"/>. Alternatively, keeping <if instance="hi"> <shortcut>Ctrl</shortcut> (<shortcut>⌘</shortcut> for macOS) </if> <if instance="cd"> <shortcut>⌘</shortcut> </if> pressed, hover your mouse pointer over the symbol.
Filter by custom conditions
You can filter the content by other custom conditions.
For example, if you have content that is only relevant to macOS users, you could set a filter with the OS name.
Then include the content if you are publishing a Mac user guide or exclude it if you are publishing a Windows user guide.
Add the
filter
attribute with the valuemacos
to the semantic elements to filter the whole element.<procedure title="Setting up" id="settings"> <step filter="macos">Step one</step> <step filter="win">Step two</step> </procedure>Or wrap the content fragment to the
if
element to filter a part of the content.<li> Start typing to filter results. <if filter="macos"> If necessary, press <shortcut>⌘+F</shortcut> to clear the filtering. </if> <if filter="win"> If necessary, press <shortcut>Ctrl+F</shortcut> to clear the filtering. </if> </li>1. Start typing to filter results. <if filter="macos">If necessary, press <shortcut>⌘+F</shortcut> to clear the filtering.</if> <if filter="win"> If necessary, press <shortcut>Ctrl+F</shortcut> to clear the filtering.</if> 2. This a step is for all OSs.
Filter reusable content
To include only certain parts of the original topic, use the
include
tag with theuse-filter
attribute in your topic.<include from="lib_settings.xml" element-id="prerequisites" use-filter="macos">Or add the
include
element to the .tree file of your product with theuse-filter
attribute.<include from = "toc_chunks" target = "settings" use-filter = "linux"/>