Variables
  • 27 May 2022
  • 5 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Variables

  • Dark
    Light
  • PDF

When you use the same text-based content in multiple places which changes over some time, you can use variables to save time. Variables are text-based content that can be used in many instances and edited on the variables overview page. It also allows you to update the content easily.

For example, you want to add your contact information in multiple instances which might change over time. In this case, you can add a variable for contact information. If a change is required, instead of updating in all instances, you can just update the variable alone.
(Contact: +1 897564231 / support@serverless.com)


Adding a Variable

2_ScreenGIF_Adding a New Variable.gif

  1. Go to Content toolsContent reuseVariable
  2. The Variable overview page appears. If you have added any variables earlier, you can see them listed here
  3. Use the dropdown at the top to select language-specific variables (Global, English, French, etc.) added to your project
  4. Click on the New variable button on the top-right, and a Add new variable blade appears
  5. Type in a Name for your variable. The name can contain characters, numbers, hyphens, and underscore

Variable Name character limit is 30 characters.

  1. The Merge code value would be the actual tag that appears in your editor

For example, If your variable name is "Disclaimer", then your Merge code value would be {{variable.Disclaimer}}.

  1. If you want a particular variable to be available across all the languages, turn on the Global toggle
    • If turned Off, you can select the available language from the Language dropdown, and the variable would be available only for that particular language
  2. In the Value, type in the content you want to add to the variable

Character limit for Variable Value

Variable Value character limit is 100 characters with spaces. If you want to add longer content, tables, or code blocks, use Snippets.

Formatting options

The below formatting options are available for variable content:

8_Screenshot-Formatting_options

a. Basic text formatting options:
Bold
Italic
Strikethrough
Underline
Font size

b. Other formatting options: Click on More text icon to access the below options
Font Family
Text color
Background color
Subscript
Superscript
Clear Formatting

c. Insert Link - To add a hyperlink.

  • Click on Insert link icon
  • Type in the URL and add a text for the URL in the Text field
  • If required, select the Open in new tab checkbox
  • Click Insert
  1. After entering the variable details, click on the Add button at the bottom-right
  2. The added variable appears on the Variable overview page

Using variables in an article/category page

You can add a variable between any sentence on the article/category page. There are two methods with which you could add a variable in your article/category page while editing.

Method 1

In the Markdown editor, type in variable.MergeCodeValue between closed double curly brackets
Example: {{variable.Disclaimer}}

But you must know the exact merge code value to add the desired variable.

Not supported in WYSIWYG editor

Typing in variable.Merge Code Value would only work in the Markdown editor.

If you use the WYSIWYG editor, please follow Method 2 (mentioned below) to add a variable to your documentation.

(or)

Method 2

  1. Click on the { } Content reuse button in the Markdown or WYSIWYG editor and select the variable or use the Search variables bar to search for the variable name
  2. Select the intended variable(s) from the search list
  3. Click on the Insert button
Note

You can select more than one variable to insert in your article/category page.

3_ScreenGIF_Adding Variable in Article.gif


Variable overview page

You can view, edit, or delete a variable on the Variable overview page.

  1. Go to Content toolsContent reuseVariable
  2. The Variable overview page appears. You can find the list of variables you have already added

4_Screenshot_Variable Overview Page.jpg

a. Languages – To filter the variables in Global or a specific language
b. Name – Variable name. Click the column header to sort
c. Value – Content of the variable. Click the name entity to view it

5_Screenshot_Variable Document used(1)

d. Documents used – If a variable is not added to any article/category page, the status would be -. If a variable is added to any article/category page, you can click on the View button to see the list of articles/category pages that contain the variable. For more information, see View article/category page dependency
e. Edit - To edit the variable content
f. Delete - To remove the variable


View article/category page dependency

  1. In the Variable overview page, you can find the column Documents used
  2. Click on the View button, and a Articles/Categories used blade appears on the right
  3. On the blade, you can view the list of articles/category pages the variable has been added
  4. Click on the article to expand the section
  5. You can find the following information:
    • The article version
    • The project version and language
    • The team account name and profile picture who has added the variable
    • The article status (Published, Draft, New Article)
    • The time/date information when the variable was inserted in the article/category page

Editing an existing Variable

6_Screenshot_Variable Edit option(1)

  1. Click on Content toolsContent reuseVariable
  2. The Variable overview page appears. You can find the list of variables you have already added
  3. Navigate the mouse over the variable you want to edit
  4. Click on the Edit icon next to the variable
  5. You can edit the content of the variable
  6. If the variable is not tagged in any article/category page, you can edit the global/local availability. If the variable is tagged in any article/category page, you cannot edit the global/local availability
  7. The Name and Merge Code Value cannot be edited
How to edit a link added in a variable?

Click the link and you can find the following options:

  • Open link - The link will open in the tab. This helps in checking the link

  • Style - Style has two options.

    • Green - To change the link text color to green
    • Thick - To increase the thickness of the link text
  • Edit - To edit the URL, link text, and change open in new tab option

  • Unlink - To unlink the URL and change it to normal text. The URL will be unlinked and only the URL text will appear

  1. After you complete the content edit, click on the Update button
Variable value change

When you edit the value of an existing variable in the library, the value change will reflect in all the articles/pages inserted by the respective variable.


Deleting a variable

7_Screenshot_Variable Delete option(1)

  1. Go to Content toolsContent reuseVariable
  2. The Variable overview page appears. You can find the list of variables you have already added
  3. Navigate the mouse over the variable you want to delete
  4. Click on the Delete icon next to the variable
  5. In the Delete confirmation prompt, click Delete
Delete dependency

If you have any article/category page dependency, you cannot delete a variable.

'Article/category page dependency - Variable is added in one or more articles/category pages.'
You must first manually remove the variable from those articles/category pages and then delete the variable.


Check out the tutorial video:


Was this article helpful?


What's Next