You are using an unsupported browser. Please update your browser to the latest version on or before July 31, 2020.
Home > Glitch in Bio > Adding Handlebars
Adding Handlebars
print icon

Your Glitch in Bio site is built using Vite, and uses Handlebars to build the JSON data into the page. The site comes with a custom helper called hostasclass included by default but you can add more.


Let's try adding a silly helper function that returns emoji to the page. In vite.config.js, after the hostasclass helper, add this function (after a comma to mark the end of the previous one):


getemoji: num => {
 let emoji = ["🚀", "😺", "⚽", "🎈", "🎉"];
 return emoji
  .slice(0, num < emoji.length ? num : emoji.length).join("");




Now to use the function in the site, in links.html add this after the closing </li> tag: {{getemoji 3}}



You'll see the emoji written into the page under each link in the preview.


Try changing the functionality or adding your own helper!


Got more questions? Check out our Community Forum!
Open 24/7, the forum is where Glitch makers help each other and show off all the rad apps that they have created. It's the friendliest community of coders on the Web!
3 out of 3 found this helpful

scroll to top icon