--- name: cloudcannon-snippets description: >- Use when adding snippet support to a CloudCannon site, configuring MDX components, Hugo shortcodes or Eleventy shortcodes and includes for the Content Editor, debugging snippet round-trip issues, or setting up inline HTML snippets in markdown content. --- # CloudCannon Snippets Snippets let editors insert and edit complex markup (components, shortcodes, embeds) inside CloudCannon's rich text Content Editor. This skill covers both the SSG layer (how components are imported/built) and the CloudCannon layer (`_snippets` config that teaches the editor the syntax). ## When to use - Adding snippet support to a new or existing CloudCannon site - Configuring MDX components, Hugo shortcodes or Eleventy shortcodes and includes for the Content Editor - Adding inline HTML snippets (figure, video, details) to markdown content - Debugging snippet parsing, round-trip, or toolbar issues ## When not to use - **The component should be a page-builder block, not inline content** — editors pick blocks from a structure, not from the rich text toolbar. See [`cloudcannon-configuration`](../cloudcannon-configuration/SKILL.md) and the migration skill's page-building guide. - **Making an existing rendered element editable in place** — that is [`cloudcannon-visual-editing`](../cloudcannon-visual-editing/SKILL.md). Snippets insert new markup; editable regions edit markup already on the page. - **Plain markdown content with no components or inline HTML** — no snippet configuration is needed ## Contents | Doc | When to read | | ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | [snippets.md](snippets.md) | Start here. Overview of both layers, configuration hierarchy, which approach to use, snippet properties, toolbar setup, raw HTML snippets in `.md` files | | [template-based.md](template-based.md) | Component syntax matches a built-in template (most common path) | | [raw.md](raw.md) | Component needs custom syntax (e.g. `client:load`, non-standard attributes) | | [built-in-templates.md](built-in-templates.md) | Understanding built-in MDX, Hugo and Eleventy templates, the import bundle, parser internals | | [gotchas.md](gotchas.md) | Preventative rules — the pitfalls and their workarounds | | [troubleshooting.md](troubleshooting.md) | Symptom index — start here when something is already broken, it routes to the rule | **SSG-specific:** | SSG | Doc | | -------- | -------------------------------------------------------------------------------------------------------------------------- | | Astro | [astro/overview.md](astro/overview.md) — MDX stack, `astro-auto-import`, when to use MDX vs raw | | Hugo | [hugo/overview.md](hugo/overview.md) — shortcodes, built-in shortcode imports, picking a Hugo template | | Eleventy | [eleventy/overview.md](eleventy/overview.md) — shortcodes and includes, picking a Liquid or Nunjucks template, `{% raw %}` | ## Quick decision | Case | Approach | | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | Component syntax matches a built-in template | Template-based — see [template-based.md](template-based.md) | | Extra syntax, SSG directives, custom parsing | Raw — see [raw.md](raw.md) | | Inline HTML in `.md` (`
`, `