---
title: "web template · RUAL Documentation"
description: "Renders a template to a piece of HTML: a section of a page, or the new version of one row for web replace. Custom pins become template variables."
canonical: https://docs.rual.nl/block-types/web/web_template
language: en
---

# web template

This block is part of the [`web`](https://docs.rual.nl/block-types/web) group and was last modified in core [`v15.0.1`](https://docs.rual.nl/core-versions/150001).

Renders a template to a piece of HTML: a section of a page, or the new version of one row for `web replace`. Custom pins become template variables.

- template `value` The template (HTML with {{mustache}}); `{{> name}}` renders a stored web template.

- data `object`

- key `value` Gives the fragment's root element this data-key.

- html `value`

- success `condition`

- error `value`

Data block (no flow pins): renders `template` (or the block's stored `html` field) with the same engine and variables as web_render (data fields, custom pins by id, `web`), and outputs html. With `key` the fragment's first element gets data-key="<key>" (kept if it already has one; plain text is wrapped in a <div>), which is what web_replace/web_remove address. Typical action answer: storage update -> web_template(template: "{{> order-row}}", data: the updated document, key: its guid) -> web_replace(key, html). An empty template renders "" with success=true; a template error outputs html="", success=false and the message on error.

| `html fragment` |
| --- |
| `partial` |
| `render row` |

[web template](https://docs.rual.nl/block-types/web/web_template) renders a template to a piece of HTML: a section of a page, or the new version of one row. It has no flow pins and runs when something reads its html. Here the fields of the posted form become template variables, so `{{message}}` is escaped for its place in the markup. That is why text a visitor typed goes through it on the way to [web update](https://docs.rual.nl/block-types/web/web_update), whose html pin takes HTML as it is. With the key pin the fragment's first element gets that data-key, which keeps a rendered row reachable for later actions. A template error gives an empty html, turns success off and puts the message on error.

[![Studio canvas example for the web template block: escaping what a visitor typed.](https://docs.rual.nl/canvas-examples/web_template.png)](https://docs.rual.nl/canvas-examples/web_template.png?v=3)

## Used in these guides

These documentation pages use or explain this block:

- [Building a Dashboard with Charts](https://docs.rual.nl/tutorials/dashboard-charts)

- [Building a Login Page](https://docs.rual.nl/tutorials/login-page)

- [Email System Setup](https://docs.rual.nl/tutorials/email-system)

- [File Upload & Processing](https://docs.rual.nl/tutorials/file-upload-processing)

- [Escaping and Security](https://docs.rual.nl/web/security)

- [Layouts and Partials](https://docs.rual.nl/web/layouts-and-partials)

- [Template Syntax](https://docs.rual.nl/web/templates)

- [Web Actions](https://docs.rual.nl/web/actions)

## Version history

Introduced in [`v15.0.1`](https://docs.rual.nl/core-versions/150001).

- [`v15.0.1`](https://docs.rual.nl/core-versions/150001): block added in this release.

- [Back to `web`](https://docs.rual.nl/block-types/web): Return to the main group to view all sub-groups

- [Back to `web templates`](https://docs.rual.nl/block-types/web?group=web%20templates): Return to the group to view all blocks within this group
