-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2-handlebars-templates.html.hbs
More file actions
32 lines (28 loc) · 1.27 KB
/
2-handlebars-templates.html.hbs
File metadata and controls
32 lines (28 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<h2 id="render-handlebars-templates">Render Handlebars Templates</h2>
<p>Handlebars templates are rendered at request time.</p>
<p>
Templates can embed content from other files—even static files and executables—via
<code>\{{get "/file"}}</code>. For example,
<a
href="https://github.com/mkantor/operator-website/blob/master/content/_features/2-handlebars-templates.html.hbs"
>this content comes from a template</a>, and here's a random number generated by
<a href="https://github.com/mkantor/operator-website/blob/master/content/examples/random.html.sh">an executable</a>:
<code>{{get "/examples/random"}}</code>
</p>
<div class="group">
<p>
Templates are provided
<a
href="https://docs.rs/operator/{{get "/_current-operator-release/version"}}/operator/content/struct.RenderData.html"
>render data</a
>
with information about the content directory, the request, the server, etc. For example, here's
the data that was provided to this template:
</p>
{{!--
Technically this will print the render data visible to the executable, which is currently the
same as the data provided to this template, but may not be forever (e.g. if Operator adds
path-specific render data).
--}}
{{get "/examples/_render-data"}}
</div>