How to make a leaf template and use it

/Views/Layouts/base.leaf is like this

#import(title) #if(body) { #import(body) } else {

Default content

} My /Views/Public/index.leaf is #extend("Layouts/base") { #export("title"): Welcome to My Vapor App #endexport #export("meta"): #endexport #export("body"):

Hello world

#endexport } and always get the error { "error": true, "reason": "import only supports string literals" }

What is happening?

Leaf does not support any dynamic imports. Try writing #import("title") instead (and for every other import too).

Furthermore, if you would like more help from the community, could you please format your snippet in a better way? As you are asking about the leaf syntax, I personally struggle to figure out where your comments start and the snippet end.

You can wrap your snippets in a code block to make it easier to read them like this:

my snippet goes here