Snippets
  • 01 Apr 2022
  • 5 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Snippets

  • Dark
    Light
  • PDF

What is a snippet?

Snippet is a predefined set of content blocks that the content manager or author identifies as reusable content. The content of the Snippet can vary from simple text/phrases to lengthy paragraphs, tables, images, and more.

In the Document360 knowledge base portal, Snippet is stored in a library. These snippets can be inserted into articles at the time of edit with a simple click of a button.

Note

The snippet inserted would not be identifiable to the reader on the knowledge base site.


Adding a snippet to the library

1_Screenshot_Content Reuse UI.png

To add a snippet to your library from your Documentation editor

  1. Click on Content tools → Content reuse → Snippet
  2. You can see the Snippet overview page. If you have added any snippets earlier, you can see them listed here
  3. Use the dropdown at the top to select language-specific snippets (Global, English, French, etc.) you've added to your project
  4. Click on the Add snippet button on the top-right and a Add new snippet side window will appear
  5. Type a Name for your snippet. The name can only contain only characters, numbers, hyphen (-), and underscore ( _ ). Space is not allowed
  6. The Merge code value would be the actual tag that appears in your editor

For example: If your snippet name is “Disclaimer” then your Merge code value would be {{snippet.Disclaimer}}.

2_ScreenGIF_Adding New Snippet global language.gif

  1. If you want that particular snippet to be available across all the languages, turn on the Global toggle
  2. If turned Off, you can select the available language from the Language dropdown and the snippet would be available only for that particular language
  3. In the Content, add the content that you want to add to the snippet

Formatting options available

The below formatting options are available for snippet content

1_Screenshot-Formatting_options_available _in_snippet

  • Basic text formatting options such as Bold, Italic, Strikethrough, and Underline are available

  • You can also use the other formatting options such as Font size, Font Family, Text color, Background color, Subscript, Superscript, and Clear Formatting

  • Ordered List and Unordered List are available for listing the items

  • You can use Insert Image to insert an image from the URL, local storage, or Drive

  • You can use Insert Link to add a hyperlink from a provided URL, or a knowledge base article to the selected text

  • Insert callouts lets you add the below three formats

Info
Warning
Error
  • Insert latex lets you add expressions and equations.
    10_Screenshot-Latex_expressions

    • Click the Insert latex option and a Insert latex expression window appears
    • Type in your desired latex syntax and click Insert
    • Click here to view the basic latex commands used in latex syntax
  • Insert table lets you create a table by selecting the required number of rows and columns

header header header
  • Insert codeblock lets you select the language of the code from a dropdown and insert the code in the field
  • You can also preview the snippet in Code view (HTML)

Once you're done, click on the Add button. The snippet would be added and displayed on the Snippet overview page.


Using Snippet in the article

There are two methods with which you could add a snippet in your article.

Method 1

Type in snippet.MergeCodeValue between closed double curly brackets

*Example: {{snippet.warningline}}

But you would have to know the exact merge code value to add any snippet.

8_Screenshot-Inserting_Snippets_from_documentation_editor_MergeCodeValue

Not supported in WYSIWYG editor

Typing in snippet.MergeCodeValue would only work if you're using the Markdown editor.

If you're using the WYSIWYG editor, please follow Method 2 (mentioned below) to add a snippet to your article.

(or)

Method 2

  1. Click on { } Content reuse button in the Markdown or WYSIWYG editor and select the snippet or use the Search snippets bar to search for the snippet name
  2. Select the intended snippet(s) from the search list
  3. Next select whether you want the selected snippet(s) to be local by turning on the Insert as local copy toggle

7_Screenshot-Inserting_Snippets_from_documentation_editor

Local snippet

If Insert as local copy toggle is on, the snippet content added in the article would remain the same here on and not be affected if the selected Snippet’s content is modified/removed in future

  1. Click on the Insert button

Snippet overview page

You can view, edit, or delete a snippet from the Snippet overview page (Content tools → Content reuse → Snippet).

3_Screenshot_Snippet Overview Page.png

a. Language – To filter the snippets in Global or a specific language
b. Name – The Snippets are listed by name and can be sorted
c. Documents used – If the snippet hasn’t been used in any article the status would be “-“. If used in the knowledge base articles, you can click on the View button to see the list of articles/category pages that contain the snippet
→ Refer "View article/category page dependency" section below for a detailed breakdown
d. Edit - To edit the snippet content
e. Delete - To delete the snippet


View article/category page dependency

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

4_Screenshot_Snippet Dependency viewer blade.png


Editing an existing snippet

5_Screenshot-Snippets_overview_page_edit_option

  1. Click on Content tools → Content reuse → Snippet
  2. You can find the list of snippets you have already added
  3. Navigate the mouse over the snippet you want to edit
  4. Click on the Edit icon next to the snippet
  5. You can just edit the content of the variable
  6. If the snippet is not tagged in any article/category page, you can edit the global/local availability. If the snippet is tagged in any article/category page, you cannot edit the global/local availability
  7. The Name and Merge Code Value cannot be edited
  8. Once you’re done with the content edit, click on the Update button at the bottom
Snippet content change

When you edit the contents of an existing snippet in the library, the content change would reflect in all the articles/pages the respective snippet has been inserted.


Deleting a snippet from the library

6_Screenshot-Snippets_overview_page_delete_option

  1. Click on Content tools → Content reuse → Snippet
  2. You can find the list of snippets you have already added
  3. Navigate the mouse over the snippet you want to delete
  4. Click on the Delete icon next to the snippet you want to delete
  5. In the Delete confirmation prompt, click Delete again
Delete dependency

You cannot delete a snippet if you have any article/category page dependency (if the snippet has been used in one or more articles/category pages).

In that case, you must first manually remove the snippet from those articles/category pages and then delete the snippet.


Check out the below tutorial video:


Was this article helpful?