November 2018
Intermediate to advanced
404 pages
10h 16m
English
The context dictionary allows you to pass custom data to the renderer for main.leaf:
let context = ["title": "Welcome to my homepage", "user": "John Doe"]return try leaf.make("main", context)
The previous code will expose title and user to your Leaf template.
In main.leaf, you can use the title and user tags passed in using Context:
<h1>#(title)</h1><p>Greetings, #(user). Welcome to my homepage.</p>
Read now
Unlock full access