Users can use the Conditional visibility and Conditional visibility (search) components to make content only visible to some users, according to selected criteria.
The Conditional visibility (search) component is available in the Search block component, and gives access to criteria specific to search features.
These criteria include:
User:
- If the user is authenticated or unauthenticated.
- What the roles of the user are, or are not.
- What tags the user has, or does not have.
- What features are available to the user.
- If the user has saved searches or not.
- Whether the user is offline or not.
Document metadata:
- What metadata key values the document has or does not have. Also, whether the metadata key has values, or not.
- What metadata key values the topics have or does not have. Also, whether the metadata key has values, or not.
- If the document has attachments or not.
Language:
- What interface language the user uses, or does not use.
- What the language of the content is, or is not.
- What the search language of the search query is, or is not.
- If the content was translated using the On-demand translation component or not (Reader page only).
Search:
- If there are results for the search query or not.
- What metadata filters the user has selected for the search.
- If search results are clustered.
Topic
- What is a topic's position in a Reader page (Topic templates only).
This list of criteria is not exhaustive.
The Conditional visibility components only hides content using CSS (display: none). Hidden content exists in the HTML source code of a page. Do not use a Conditional visibility component to hide or show sensitive information.
- When designing a page, select the Conditional visibility highlight button in the footer to preview the page based on the Preview configuration.
- Use the Notification when the component becomes visible option to create a notification for screen readers. The notification has an
aria-live="polite"attribute: the screen reader reads the message when the user finishes their current activity, without interrupting them. It is possible to use a localized label as the notification text.