Templating
linotype/Block
The template of a block allows you to code a piece of your site. Lots of variables and functions are available to make your template powerful.

Default variables

TWIG
PHP
JSX
<div id="{{block.id}}" uid="{{block.uid}}" class="{{block.class}}">
<h1>Hello world !</h1>
{{childrens}}
<div>
TODO
TODO with v8js ssr
variable
description
{{block.id}}
Unique block ID: #block--block_key
{{block.uid}}
Unique block ID: #md5(themeKey__templateKey__blockKey)
{{block.class}}
Class id .block--block_id
{{block.childrens}}
Array of childrens defined in module or template config
{{childrens}}
Rendered childrens define in module or template config

Context variables

Use your context key just like variables. Their values change depending on the configuration and where the block is used.
TWIG
PHP
JSX
{% if context_id_1 and context_id_2 %}
<div id="{{block.id}}" uid="{{block.uid}}" class="{{block.class}}">
{{context_id_1}}
{{context_id_2}}
<div>
{% endif %}
TODO
TODO with v8js ssr

Functions helper

Create a helper and use them in your template to enrich your content.
TWIG
PHP
JSX
{% set title = linotype.helper.format.removeTags( text ) %}
<div id="{{block.id}}" uid="{{block.uid}}" class="{{block.class}}">
<h1>{{title}}</h1>
<div>
TODO
TODO with v8js ssr
Copy link
On this page
Default variables
Context variables
Functions helper