Rendering

Rendering

This template:

HTML
<html>
<head>
  <style>
    h2 {
      background-color: {{bg-color}};
    }
  </style>
</head>
<body>
  <h2 ut:style="font-size: {{headerFontSize}}px;" data-html-friendly="true">{{header}}</h2>
  <form>
    <input type="text" name="name" />
    <input type="email" name="email" />
    <input type="submit" ut:text="{{submitText}}"/>
  </form>
  <script src="https://js.trustisto.com/socialproof_succker.js"></script>
</body>
</html>

with this request

Text
GET /template_folder/
       ?id=1
       &locale=en
       &bg-color=white
       &headerFontSize=12
       &header=Hello
       &submitText=Send

will render to this:

HTML
<html>
<head>
  <style>
    h2 {
      background-color: white;
    }
  </style>
</head>
<body>
  <h2 ut:style="font-size: 12px;" data-html-friendly="true">Hello</h2>
  <form>
    <input type="text" name="name" />
    <input type="email" name="email" />
    <input type="submit" text="Send"/>
  </form>
  <script src="https://js.trustisto.com/socialproof_succker.js"></script>
</body>
</html>

When we render a template, we call index.html file via HTTP or HTTPS (secure) GET request with query params:

  • id - id of the object that use this template
  • locale - selected locale ex. pl, en
  • ...other params defined in manifest

All parameters ex. {{title}} will be replaced (evaluated) by value from (in order):

  • query string parameters (so parameters witch user edited)
  • manifest default value in selected locale
  • manifest default value in english when locale of that parameter is not found