Skip to main content
Administrators only

Variables and Questions

Variables are how a template stays generic while letting each message customize itself. Inside your HTML you write {keyName} placeholders; for each placeholder you define a Question that tells the message creator what to fill in. At render time, the placeholder is replaced with the message's Answer.

The flow

Template HTML → {keyName} placeholder


Question → defines keyName, title, fieldType, default


Message Answer → the actual value (image URL, text, zip code, etc.)


Rendered HTML → placeholder replaced with answer value

When a message plays:

  1. SignPresenter loads the template's questions.
  2. It loads the message's answers (one per question).
  3. For each question, it picks answer value > question placeholder.
  4. Every {keyName} in the HTML is replaced with the chosen value.
  5. The result is sent to the WebView.

Defining a question

In the template editor, the right column has a Questions panel. For each variable in your HTML, click + New and fill in:

FieldWhat it does
Key NameThe exact text inside {braces} in your HTML. Lowercase, no spaces.
TitleThe label shown to the message creator in the message editor.
Field TypeControls the input widget — see the table below.
PlaceholderThe default value used if the message creator doesn't provide one.
ChoicesFor select, the dropdown options. For image, the aspect ratio.

Questions save automatically when you save the template.

Field types

TypeRenders asUse for
textSingle-line text inputNames, short labels
textareaMulti-line text inputLong descriptions, HTML snippets
imageImage picker with cropperPhotos, logos, backgrounds
videoVideo picker with uploadVideo sources
audioAudio pickerSound files
selectDropdownPicking from a fixed list
colorColor pickerBackground colors, accents
booleanTrue/false toggleLoop video, autoplay, etc.
messagePicker for another messagePointer templates that redirect to another message
playlistPicker for a playlistMulti-zone layouts

For image, the Choices field takes width,height like 1920,1080 to lock the cropper to the right aspect ratio.

For select, the Choices field takes comma-separated options like red,blue,green.

Placeholder syntax

The simplest form is just {keyName} — replaced with the answer's value as plain text.

Escaped form: {keyName!}

Adds an exclamation mark inside the braces to escape single quotes in the value. Use this when the answer is going to live inside a JS string literal:

<script>
const title = '{title!}'; // safe even if the answer contains '
</script>

Without the !, an answer like Joe's would break your JavaScript.

Array form

If an answer value contains backticks (```), it's converted to a JS array literal at substitution time. Useful when one variable should hold many values:

// Answer: "How are you?`Hello`World"
const items = [{questions}];
// Becomes: const items = ["How are you?", "Hello", "World"];

This is how the Trivia built-in template stores question lists in a single answer.

Auto-injected variables

These don't need a question — SignPresenter provides them automatically:

VariableValue
{id}The current message's ID
adSecondsThe display duration, exposed as a JS global (not a {} placeholder)

adSeconds is the canonical way to time animations — see Lifecycle hooks.

Defaults vs answers

Every question has a Placeholder (default) value. If a message doesn't provide an answer for a question, the placeholder is used.

This is how built-in templates ship with sensible defaults — the Weather template's {zipCode} placeholder is a generic zip, but every message overrides it with the user's actual zip.

Reusing questions across templates

There's no shared question pool — each template owns its own questions. If you have several templates that all need a {logo} variable, you'll define logo separately on each. Tedious, but explicit.

(For public feeds, questions work the same way but are scoped to the feed instead of a template — so a feed can ask its subscribers for one set of answers that all the feed's templates inherit.)

Tips

tip

Name your key names consistently across templates — image, title, subtitle, bgColor. It makes it easier for users to remember which fields a message will ask for.

warning

Don't put { or } characters in HTML literals (e.g., inside CSS calc() or template literals) — SignPresenter's substitution will try to match them as variables. Use &#123; and &#125; for HTML entities, or move dynamic CSS into JS.