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.

Video tutorial: using snippets in Omni CMS