web render

This block is part of the web group and was last modified in core v15.0.1.

web render v15.0.1

Renders the page template on the server and answers the request with the finished HTML: title, description, canonical link, Open Graph and Twitter tags, hreflang links and JSON-LD are written for you. Custom pins become template variables.

In pins 13 + flow
  • flow
  • connection httpconnection required
  • template value

    The page template (HTML with {{mustache}}). Leave unwired to use the template stored on this block.

  • data object

    The template's variables.

  • title value

    Page title: <title>, og:title.

  • description value

    Meta description and og:description.

  • image value

    Share image (og:image, twitter:image). A /path becomes an absolute URL.

  • canonical value

    Canonical URL; defaults to this page's URL without query.

  • layout value

    Name or GUID of a stored template that wraps the page; it prints the page with {{{body}}}.

  • meta object

    More head tags as {name: content}, e.g. {"robots": "noindex", "og:type": "product"}.

  • JSON-LD object

    Structured data written as application/ld+json.

  • status number

    HTTP status code.

    Default 200

  • cache seconds number

    How long shared caches may keep the page. 0 (default): browsers revalidate with the ETag every time.

    Default 0

  • headers array<object>

    Extra response headers, [{key, value}].

Out pins 4 + flow
  • flow
  • connection httpconnection
  • html value

    The finished HTML document.

  • success condition
  • error value

Renders the `template` pin (or, when unwired, the template stored on the block's `html` field) with the web template engine: Mustache ({{x}} escaped, {{{x}}} raw, {{#list}}..{{/list}}, {{^x}}) plus {{if a == 'b'}}..{{else if}}..{{else}}..{{/if}}, {{for item in items}}..{{else}}..{{/for}}, {{@index}}/{{@number}}/{{@first}}/{{@last}}, {{> name}} partials (stored web templates by name, or {{define "name"}} blocks), {{t "key" n=count}} translations, and filters {{price | money "EUR"}}, number, date "DD-MM-YYYY", upper, lower, truncate N, default x, json, join, length, nl2br, urlencode, plus/minus/times/divide, round, slug. Escaping follows the HTML context: javascript: URLs are refused, <script> code gets JSON (write `const x = {{x}};` without quotes). Compile errors: a {{> partial}} anywhere but where text goes; if/else or section branches that end in different HTML places (open and close tags inside each branch); a URL scheme formed by data (write `https://{{host}}`). Template variables: the `data` object's fields, every custom pin by id, `web` {language, nonce, url, path, origin, action, signed_in}, and title, description, nonce, language, head. Document: a template starting with <!doctype or <html is the whole document; else `layout` (a stored template by name or GUID, the same documents mail templates use, rendered with {{{body}}} = the page and {{{head}}} = the head tags; also the block's template_guid) wraps it; else a plain HTML5 shell. Head tags (title, meta description, canonical = the page URL unless set, og:*, twitter:*, hreflang alternates, JSON-LD from `json_ld`, `meta` extra {name: content}, the runtime script and prefetch rules) go where {{{head}}} is, else before </head>; a tag the markup's head already has is not repeated. Response: `status` (default 200), `headers` [{key,value}], `cache` seconds (>0 lets shared caches keep it; ignored for a signed-in visitor), ETag with 304, a per-response CSP nonce (write nonce="{{nonce}}" on inline scripts; inline on* handlers are blocked). A template error renders a 500 page that names it and sets success=false, error. Out-pin html is the finished document. Outside a web page (an API endpoint flow) it answers its connection with text/html instead.

render html
html template
web template
server side render
ssr
og tags
seo

The page reads :slug off its params with get fields, and search single finds the document. web render then answers the request: the fields of the object on its data pin become template variables, and a custom pin, here note, adds a value of your own. The template is a value that names a stored partial. The head tags are written for you from the title, description and image pins. A template error renders a 500 page that names it and turns success off.

Studio canvas example for the web render block: rendering a stored document.

Used in these guides

These documentation pages use or explain this block:

Version history

Introduced in v15.0.1.

  • v15.0.1: block added in this release.

Back to web Return to the main group to view all sub-groups Back to web pages Return to the group to view all blocks within this group