Dynamic Content
Doctave supports dynamic content via user preferences. This means you can customize what content your readers will see based on their preferences.
Customizing content in Markdown
Markdown content can be customized based on user preferences.
For example, if you have defined a user preference called plan
, like above, you can access the
current value:
{% if DOCTAVE.user_preferences.plan == "Starter" %}
You are on the starter plan
{% endif %}
Or, you can render the current value:
{{ DOCTAVE.user_preferences.plan }}
Customizing navigation
Sections in the navigation can be shown based on a condition, using the show_if
property.
- heading: API Reference
show_if:
user_preferences:
plan:
one_of:
- Growth
- Enterprise
In the above example, we are telling Doctave to only show the API Reference section if the user has selected as their plan either Growth or Enterprise. See more in the User Preferences section.
Conditionals are based on matchers which you can use to determine when a section or link should be shown.
Equals
equals
is the simplest matcher. It checks that the given plan is an exact match.
show_if:
user_preferences:
plan:
equals: Enterprise
One Of
one_of
matcher expects as an argument
a list of values to match against.
show_if:
user_preferences:
plan:
one_of:
- Growth
- Enterprise
Was this page helpful?