Skip to documentation content

Snippets

Snippets

A snippet is an editor-owned block of HTML with no URL, output with the snippet method and updated in one place.

Snippets are a separate, editor-friendly object type. They are closer to articles or blog posts than to templates, except they have far fewer fields and they cannot have a URL. The main field on a snippet is HTML, and the CMS UI edits that field with a WYSIWYG editor. That makes snippets a good fit when an editor or non-technical marketer needs to change a reusable block of markup occasionally without looking at code or having access to other templates.

Output a snippet from Liquid with the snippet method, for example {% snippet output_to_html = "CTA1" %}, or by writing {{ snippet.content_html }}. Changing the snippet in the CMS updates every place that snippet is used. You can also insert a snippet into another HTML field from the editor toolbar; that inserts a live reference, not a one-time copy.

Choose a snippet when the fragment is content that editors should own, and an include (Includes) when it is structure or logic that belongs in a template. Reusing Content covers the wider choice among the ways to define content once.