Tutorial #5: Snippets

Snippets are reusable pieces of content to help keep you from typing in the same thing over and over again.

For example, this help tutorial has the same menu on the left of each page in the sidebar. Instead of typing this list of links on each page, we created a snippet. Each page uses that snippet. When we need to add a tutorial page or change the name of a link, we just update the snippet, and all the tutorial pages get updated.

Creating a Snippet

1. Log into the CMS
2. Click on the “Snippets” tab
3. Click on “New Snippet”
4. Give your snippet a unique name. The name can’t contain any spaces. By convention, we use dashes instead of spaces for multiple word names.
5. In the Body section, add the following content to your snippet:

*Hello from my Snippet*

6. Set the Filter drop-down to “Textile”
7. Save the snippet

Using a snippet

  1. Click on the “Pages” tab
  2. Navigate to your test page. Click on it to edit it.
  3. Insert the following into your page, replacing test-snippet with the name of your snippet:

<r:snippet name=”test-snippet”/>

  1. Save and Continue Editing your page
  2. View it in your browser

You should now see the bold snippet text in your test page