Variable scopes
Create variables scoped to:- A single page — Available only on that page
- A single space — Available across all pages in the space
Create a new variable
To create a variable:- Click Library in your table of contents while editing a change request
- Click Variables
- Toggle between page-level or space-level scope
- Click Create a variable
- Enter a name and value
- Click Add variable
Variable names must start with a letter and can contain letters, numbers, and underscores.
- Name:
latest_version - Value:
v3.04.1
Use variables in content
Variables are referenced within expressions that you can insert inline into your content. To insert a variable:- Press
/and select Expression from the insert palette - Double-click the expression to open the expression editor
- Reference your variable:
- Page variables:
page.vars.variable_name - Space variables:
space.vars.variable_name
- Page variables:
- Example usage
- With conditions
Create a variable called This will display: GitBook Pro
product_name with value “GitBook Pro”.Then in your content, add an expression:Update a variable
Update a variable anytime within a change request:- Open Library > Variables
- Find the variable you want to update
- Edit its value
- Save your changes
Variables are especially useful for version numbers, API endpoints, product names, and any content that changes frequently across multiple pages.
Variables in adaptive content
Variables can also be used in conditions for adaptive content, letting you show different content based on variable values.Best practices
Use descriptive names
Name variables clearly:
api_endpoint_production instead of api_urlChoose the right scope
Use page-level for page-specific values, space-level for shared content
Document your variables
Keep a list of variables and their purposes for team reference
Update in change requests
Always update variables within change requests for proper version control