JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Gallery
Share
Explore
Handlebars Pack User Guide
Install
Follow the link below to learn more about the Handlebars Pack for Coda and install it. You can also type
/Handlebars
into any Coda doc.
Loading
coda.io
Usage
The primary formula in the Pack is
TemplateReplace()
, which takes as parameters the template text and the placeholder values.
TemplateReplace
(
"Hello {{name}}, welcome to {{place}}!"
,
"name"
,
"Alice"
,
"place"
,
"Earth"
)
=
"Hello Alice, welcome to Earth"
For more complex usage you can pass the replacement values as a string of JSON and use the alternative
TemplateReplaceWithJSON()
formula.
TemplateReplaceWithJSON
(
"Hello {{person.name}}, welcome to {{planet.title}}!"
,
'{"person": {"name": "Alice"}, "planet": {"title": "Earth"}}'
)
=
"Hello Alice, welcome to Earth"
There is also a
Placeholders()
formula which will return a list of placeholders present in a template.
To learn more about the Handlebars templating language, check out this documentation.
View documentation
Demo
The demo below demonstrates how to define templates and use those templates in with real values.
Templates
Templates
Name
Template
Placeholders
Name
Template
Placeholders
1
Accepted
Hello {{name}},
We’re happy to tell you that you have been
accepted
into the program. Your start date is {{date}}. We can’t wait to see you!
- The Team
name
date
2
Rejected
Hello {{name}},
We regret to inform you that you
have not been accepted
into the program. {{#if reason}} Our reviewers have provided the following reason:
{{reason}}
{{/if}}
We hope you re-apply in the future.
- The Team
name
reason
There are no rows in this table
Applications
Applications
Name
Template
Start Date
Reason
Result
Name
Template
Start Date
Reason
Result
1
Alice
Accepted
6/1/2024
Hello Alice,
We’re happy to tell you that you have been
accepted
into the program. Your start date is 6/1/2024. We can’t wait to see you!
- The Team
2
Bob
Rejected
You need
even more
practice.
Hello Bob,
We regret to inform you that you
have not been accepted
into the program. Our reviewers have provided the following reason:
You need
even more
practice.
We hope you re-apply in the future.
- The Team
There are no rows in this table
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.