You can copy the yaml-code below and use it as frontmatter for an example page.
You can paste this URL into GitHub Issues to share your setup when filing bugs or questions
Handlebars:
Template
{{link "See Website" href=person.url class="person"}}
Preparation-Script
Handlebars.registerHelper("link", function(text, options) {
var attributes = [];
Object.keys(options.hash).forEach(key => {
var escapedKey = Handlebars.escapeExpression(key);
var escapedValue = Handlebars.escapeExpression(options.hash[key]);
attributes.push(escapedKey + '="' + escapedValue + '"');
})
var escapedText = Handlebars.escapeExpression(text);
var escapedOutput ="<a " + attributes.join(" ") + ">" + escapedText + "</a>";
return new Handlebars.SafeString(escapedOutput);
});
Input
{
person: {
firstname: "Yehuda",
lastname: "Katz",
url: "https://yehudakatz.com/",
},
}
Output
<a class="person" href="https://yehudakatz.com/">See Website</a>