This key toggles whether CloudCannon will treat content as optional when parsing snippet parameters.
Setting this key to true will make the content parameter optional, allowing snippets to match even when the content is missing.
By default, this key is false (i.e., content is required).
Appears in#
Type#
boolean
Examples#
In this example, we have configured content parser to treat content as optional.
Copied to clipboard
_snippets:
highlight:
snippet: <<highlight>> [[content]] <</highlight>>
params:
content:
parser: content
options:
editor_key: highlighted_text
optional: true{
"_snippets": {
"highlight": {
"snippet": "<<highlight>> [[content]] <</highlight>>",
"params": {
"content": {
"parser": "content",
"options": {
"editor_key": "highlighted_text",
"optional": true
}
}
}
}
}
}