Creating and Managing Snippets
Snippet management and creation is available to Level 9 and 10 admins. Categories are also configured, which are used for sorting snippets when selecting one to place on a page. Both snippets and categories are accessible from Content > Snippets.
Selecting Content > Snippets brings you to the Snippet Categories view.
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.
Categories are often used to sort snippets by function or by type of pages they should be placed on. All snippets must belong to a category; therefore, you must have at least one category configured to create snippets.
Hovering over a category brings up the following menu options:
- Delete: Deleting a category also deletes all snippets within that category. Deleting a snippet does not remove it from a page, but the snippet file cannot be restored.
Creating a Category
To make a new category:
- Navigate to Content > Snippets. The Snippet Categories view is shown by default. Otherwise, click Categories.
- Click the green +New button in the upper right of the screen.
- Give the new category a friendly name, which will help end-users determine where the
snippet is located.
- Click Create.
Select Snippets from the left-hand menu to display the Snippets list view.
From this view you can see all snippets in the account. You can filter them by name, sort by name, category, last modified date, description, and how many sites they are available to. 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 (see more in the next section)
- Snippet: Dropdown with two options - "Rename" and "Delete." Deleting a snippet is a permanent action. It does not remove a snippet from pages it has been placed on.
Select multiple snippets by clicking the checkboxes next to the snippets' names. With one snippet selected, the header options are Preview, Edit, Access, and Delete. The Access option allows you to select the group of users that can place the snippet on pages. When multiple snippets are selected, the only available options are Access and Delete.
To create a new snippet:
- In Snippets List View or while viewing the list of snippets in a category, click the green +New button.
- There are two panels: Snippet Information and Snippet Source Code.
- Snippet Information contains the following fields:
- Name: The name for your snippet ought to indicate its function, such as "Two-Column Table" or "Block Quote." Required.
- Category: Select a category for your snippet to belong to. Required.
- Available for All Sites?: Choose whether this snippet will be available to all sites in the account or not. If you choose to limit it, select from the list of sites which site or sites it will be available to.
- Available To: Select the group that has access to this snippet and can place it on pages. By default "Everyone" will be selected.
- Description: Add a description of the snippet, such as what it's used for or where on a page it should be used.
- Snippet Source Code is a source code editor. Enter the snippet code, remembering that
when the snippet is placed on the page, it will become part of page's code and will
be affected by the behavior of the WYSIWYG editor, which may remove certain kinds of markup. Therefore HTML is recommended.
When creating a snippet that contains an image, use the full path to the production server to be able to preview the image in the Snippet Preview window before inserting it on the page.
- Once you are finished, click Create to make your snippet. The snippet is now available for use on pages.
To edit a snippet, click on its name in any of the list views, or hover over it and select "Edit." The available fields are the same as those present when creating a new snippet.
Unlike assets, which can be edited once and those changes applied to all subscribed pages, editing a snippet does not change pages on which the snippet has already been placed.