351 Using Snippets to Format Content

What Are Snippets?

Snippets are pieces of pre-written code that can be inserted into pages and customized with content specific to that page. For example, an accordion snippet allows site contributors to add a snippet to their site, and adjust the headings and content of the accordion in order to suit the needs of their site, while retaining the accordion functionality.

Snippets are useful in formatting content, because they already include that proper HTML code and CSS attributes necessary to display properly, while also allowing for the content to be adjusted as necessary.

As soon as a snippet is inserted into a page, it becomes standards HTML code, which can be modified or altered the same as other code on the page. This being the case, there is potential for a snippet to break if the underlying code is accidentally deleted or altered. Efforts are made to build snippets that are easy to work with in the editor, but there may be instances of snippets being broken when they are improperly modified. If this happens, you may choose to revert your page to the previously published version and re-insert the snippet.

Adding a Snippet to a Page

Add a snippet to a page

Click on the "Insert Predefined Snippet" icon:

Icon to insert snippet into page

In the dialogue window that opens, choose the catergory of the snippet you would like to insert. Browse for the snippet you would like to insert, and click "Insert":

Snippet dialogue window

Video Tutorial: Using Snippets in OU Campus