---
description: The in-app Template Editor — opening a template, editing files and assets, checking binding attributes with Validate Template, saving as a new version with validation and the deploy confirmation — and the analysis report with its static and AI findings, Markdown export, and what happens when an AI run fails.
---

# Template Editor and analysis

Templates are uploaded per event as ZIP files, and the web app provides tools to inspect,
edit, and review them without leaving the browser. For *writing* templates, start at
[Getting started with templates](getting_started.md); this page covers the
in-app tooling. Uploading, renaming and deleting are on [Template library](template_library.md).

## Opening a template in the Template Editor

Every template can be opened in the **Template Editor**: from the Template List's row menu
(*Open in Template Editor*), or from the template links on the event and room settings
pages, which open it in a new tab. Administrators also have a **Template Editor** entry in
the navigation bar; it starts from a chooser where a new template can be begun from the
base template or from a ZIP file on your computer.

The editor shows the template's files (HTML, CSS, JS, assets) as they were uploaded —
useful for checking what a sign is actually running — with a live preview that can use real
event and room data. Any file can be downloaded, text can be copied to the clipboard, and
the JSON data behind a selected room item can be viewed.

## Editing template files in the app

Text files (HTML, CSS, JS) open in the built-in code editor. A text file over the editor's
size limit (2 MB by default) can't be opened there; select it and use **Download** to get a
copy. Assets such as images, videos and fonts can be added, replaced, renamed and deleted,
and files can be organized into folders. Two things make the editor safe to use on a live
event:

- **Saving creates a new template version.** Files are never overwritten in place: the
  save produces a new template (with a new internal ID) after full validation and
  sanitation, and the app moves you to that new version. Assignments are updated, and
  running signs pick the change up through their normal update cycle.
- **Validation runs on every save**, the same checks as a ZIP upload — a save that would
  produce a broken template is rejected. The editor also checks the template before
  sending it and warns about missing files, broken asset references or
  [binding attribute mistakes](#validate-template), so most problems can be fixed before the
  save is attempted.

If the template is live on signs, the button reads **Save and Deploy** and asks for
confirmation first, listing the events, rooms and scheduled items whose signs will reload.
**Save as New** leaves the open template untouched and creates a copy under a new name.

Users with the read-only role can open, browse, preview and download templates but cannot
change or save anything; the editor shows a *Read-only* marker. Generated files (like the
runtime wrapper) are not shown and cannot be edited.

## Validate Template

**Validate Template** in the header of the **Template Editor** checks the binding attributes in
`index.html`, such as `data-condition` and `data-field`, the way the sign reads them. It checks
your current text, saved or not, and changes nothing, so read-only users can run it too. It doesn't
check HTML, CSS or JavaScript: [the static analysis](static_analysis.md) does that when you save.

Findings come in two groups, in file order:

- **Won't work as written** lists mistakes to fix, such as
  `role === 'Speaker' || 'Sponsor Speaker'`, where `'Sponsor Speaker'` on its own counts as true.
- **Worth checking** lists things that might be on purpose.

A finding shows its line, the attribute's value with the problem part highlighted, what the sign
does with it and, where there is one, a suggested fix. **Go to line** closes the dialog and moves
the cursor there, opening `index.html` if another file is selected.

**Save** and **Save as New** run the same checks and list what they find under **Possible issues
before saving**, where you can go back or save anyway.

### Check against real data

**Check against** also runs your `data-condition` attributes on real data, so you can see which
items a condition hides. It needs a template saved to an event, with at least one
`data-condition`.

| Option | What it checks |
| --- | --- |
| **Template only** | The template alone. This is the default. |
| **This item** | One item or gap of the room you pick. |
| **All items in a room** | The items that use this template in the room you pick. If none do, its gaps when this is the room's Gap Template, or else all its items. |
| **Real event data** | Every physical room's items, disabled rooms included. An Event Scoped Template has this option instead of the two above. |

With a room and an item picked under **Data source** in the preview, **Room** and **Item** start
from those.

The results appear under **Worth checking**, as they can be on purpose:

- **Hidden for 9 of 14 items in Room A: they have no `target` field.** The condition reads a field
  those items don't have, so the sign hides the element on them.
- **3 of 14 items in Room A have no `location` field, so for them the condition uses the browser's
  own `location`, and the element shows.** A name the item doesn't have falls through to the
  browser, or to an element with that id, as the
  [Data binding reference](basic/unsupported_characters_expressions.md#data-condition) explains.
- **No item in this event has `type` equal to `'Sponsored session'`.** With **All items in a room**
  or **Real event data**, text compared with `===` or `==` is looked for across the whole event. The
  finding lists the closest values, and **Did you mean** when only case or spaces differ.

What the check can't see:

- Fields a sign gets from its URL ([URL query parameter overrides](../signs/query_param_overrides.md))
  aren't in this data, so they can show as missing. A line under the result says so when that could
  be the case.
- A value your template's own script sets reads as missing too. In a row of a room grid
  (`data-event-rooms`), the check says the element never shows.
- Logic it can't follow, such as most function calls, isn't guessed at. A line says how many
  conditions weren't fully checked. When a finding counts items, gaps or array entries, its total
  includes the ones the check couldn't follow, and it says how many those were.

## Template Analysis

When a template is uploaded, the system analyzes it and stores a report you can open from
the template's pages:

- **Findings** are listed with a severity (*Error*, *Warning*, *Info*) and a source, and
  can be filtered by both. Errors point at things that will break rendering; warnings and
  info flag risky or non-standard constructions. The **View** link beside a static finding
  opens its entry on [What the static analysis checks](static_analysis.md).
- The summary cards show the finding counts and when the analysis ran.
- The report can be **exported as Markdown** — handy for sending feedback to an external
  template author.

Part of the analysis is performed by an AI model, which an administrator configures under
[LLM Analysis Configuration](../admin/llm_analysis_config.md). If no analysis exists for a
template (for example, analysis was disabled at upload time), re-uploading the same
template generates one.

The AI reviews the three authored root files — `index.html`, `styles.css` and, when present,
`script.js`. Files under `assets/` (helper scripts, bundled libraries such as `hls.min.js`,
images, fonts) and the generated `runtime.*` / `preview.*` files are not sent, so keep the
template's own logic in `script.js` if you want the AI to check it.

### When the AI analysis does not complete

An AI run can fail (the model returns nothing usable, the provider is unreachable) or be
skipped (AI analysis is switched off, credentials are missing, or the template holds no
files to analyze). In either case the AI findings from the previous successful run are
**kept** — a failed run never replaces good results with an empty or partial report.

Because the findings on screen may then predate the last attempt, the report shows a
banner above the summary cards saying whether the last AI run failed or was skipped, with
the reason and the time it was attempted. The banner also appears in the Markdown export.
The static (non-AI) findings are unaffected either way. Re-run the analysis once the
underlying problem is fixed, and the banner clears when a run succeeds.

## Related

- [Template library](template_library.md)
- [What the static analysis checks](static_analysis.md)
- [Getting started with templates](getting_started.md)
- [Template JavaScript best practices](advanced/template-js-best-practices.md)
- [Testing and troubleshooting templates](testing_troubleshooting.md)
- [LLM Analysis Configuration](../admin/llm_analysis_config.md) — provider setup (admin)
