Helpers in Curlybars are functions that provide additional functionality to your templates, such as formatting data or performing operations.
For example, theexcerpt
helper can truncate a string to a specified number of characters. You can invoke a helper using the syntax{{<helper> [<param> ...] [<key=value> ...]}}
. Helpers can also be used with conditionals to perform more complex logic, such as checking for equality with theis
helper.
The Zendesk Help Center uses a templating language called Curlybars, which is similar to Handlebars. Curlybars allows you to customize the layout and content of your Help Center pages by using a mix of HTML and templating expressions. Curlybars…
In Curlybars, you can add comments to your templates to include notes that won't appear in the rendered page. This is useful for documentation or debugging purposes. To add a comment, use the syntax{{! ... }}
for single-line comments. For…
Literals in Curlybars are values that are interpreted exactly as written, and they can be strings, booleans, or numbers. This allows you to include static data in your templates. Strings can be enclosed in single or double quotes, booleans are…
Curlybars allows you to use conditionals to control the rendering of content based on certain conditions. This is useful for displaying different content based on the data available. You can use{{#if condition}} ... {{/if}}
to render content if…
To access items in an array in Curlybars, you use theeach
helper, which iterates over each item in the array and allows you to render content for each one. For example, if you have an array of attachments, you can use `{{#each attachments}} ……
In Curlybars, you can change the scope using thewith
construct, which allows you to set a new base context for a block of code. This is useful for simplifying long property paths. For example, using{{#with article.author}} ... {{/with}}
lets…
Curlybars allows you to trim white space around expressions using the tilde character~
. This helps control the spacing in your rendered HTML. By placing a tilde in the opening or closing curly brackets, you can remove unwanted spaces. For…