Create and Manage Snippets
Snippet creation and management is limited to level 9 and 10 users. Categories are also configured, which are used to sort snippets. Both snippets and categories are accessible from Content > Snippets.
CategoriesLink to this section
Selecting Content > Snippets shows you snippet categories. This view lists all snippet categories for the account. You can filter the categories by name, sort categories by name and number of snippets, and click on a category name to see the snippets inside it.
All snippets must belong to a category; therefore, you must have at least one category to make snippets.
Hovering over a category brings up the following menu options:
- Rename: Renaming a category only changes its name and affects no other files.
- Delete: Deleting a category also deletes all snippets within that category. Deleting a snippet does not affect any pages, but the snippet file cannot be restored short of making it again.
To make a new category:
- Navigate to Content > Snippets. If you're not already viewing categories, click "Categories" in the left-hand menu.
- Click the green +New button in the upper-right of the screen.
- Give the category a name that indicates the type of snippets that are grouped within it. Commonly, categories group snippets by function, or by the type of site or page they should be placed on.
- Click Create.
ManageLink to this section
In Content > Snippets, select "Snippets" from the left-hand menu to see the list of snippets for the account.
Hovering over a snippet brings up the following menu options:
- Preview: Displays a preview of the snippet code. This may not accurately reflect the appearance of the snippet when added to a page, as styling has not been applied yet.
- Edit: Takes you to the edit view of the snippet.
- Snippet: Dropdown with two options, "Rename" and "Delete."
- Renaming a snippet only changes its name and affects no other files.
- Deleting a snippet is a permanent action, and the snippet cannot be restored unless it is made again. Deleting does not remove a snippet from pages it has been placed on.
CreateLink to this section
To make a new snippet:
- Navigate to Content > Snippets.
- Either select "Snippets" from the left-hand menu or click a category to see the snippets inside.
- Click the green +New button.
- Fill out the snippet information. It contains the following fields:
- Name*: The name for your snippet ought to indicate its function, such as "Two-Column Table" or "Block Quote."
- Category*: Select a category for your snippet to belong to.
- Available for All Sites?: Choose whether this snippet is available to use for all sites in the account or not. If you choose to limit it, select from the list of sites which site or sites it is available to.
- Available To: Select the group that can place this snippet on pages.
- Description: Add a short description of the snippet, such as what it's used for or where on a page it should be placed.
- Write the snippet source code. Remember that when the snippet is placed on the page, it becomes part of the page's code and is affected by the WYSIWYG editor, which may remove certain kinds of markup. Therefore HTML is recommended.
- Snippets should not include server-side or client-side code. It is possible to include classes that are called by client-side and server-side code, however.
- When creating a snippet that contains an image, use the full path to the production server to be able to see the image when previewing a snippet.
- Click Create to make your snippet. It is now available for use on pages.
Once created, snippets do not need to be published. Additionally, editing a snippet does not affect pages on which the snippet was already placed.