Adapting your content
Tailor your content for different users.
After setting up your authentication method, you’ll be able to use the data to adapt the content in your site for different users.
Adaptive content works in the following ways:
Hiding or showing pages
Hiding or showing site variants
Hiding or showing site sections
Working with the condition editor
The condition editor is where you’ll set the conditions for showing or hiding a page, variant, or section. After opening the condition editor, you’ll be able to type a condition that will run against visitors to your site.
Example
The data you pass through your users to GitBook is attached to an object called visitor.claims
.
Let’s take a look at an example if we want to write a conditional statement to only show a page for users who are part of a beta program you might define.
The condition above means that any user who matches this claim (i.e. isBetaUser
is true
in the user’s claim), will be able to see and access the page. Any user who does not match this claim (including visitors without any claims set), will not be able to see or access the page.
The condition editor also comes built in with autocomplete, which suggests claims or attributes that have been found on previous visitors to your site, helping you craft the conditional statement for your pages, variants, or sections.
You can combine multiple claims into the condition editor to match specific users by using the &&
or ||
operator. You can read more about operators here.
Conditional pages
To launch the condition editor for a page, head to the actions menu next to a page, and click “Add condition”. You can also launch the condition editor from a page’s options.
You can see which pages in your space have conditions set if the page has a page condition icon next to it.
Conditional variants
To launch the condition editor for a variant, head to the actions menu next to a variant, and click “Add condition”.
You can see which variants in your docs have conditions set if the variant has a page condition icon next to it.
Conditional sections
To launch the condition editor for a section, head to the actions menu next to a section, and click “Add condition”.
You can see which sections in your docs have conditions set if the section has a page condition icon next to it.
Last updated
Was this helpful?