jet icon indicating copy to clipboard operation
jet copied to clipboard

Unable to include - template could not be found

Open richp10 opened this issue 3 years ago • 4 comments

I'm sure this is a stupidly simple problem - but I'm staring at it and just can't see what is going on!

Views are in a folder two levels below the executable (in www/views) and jet is configured like this:

engine = jet.New("www/views", ".jet")

I have a template www/views/register.jet that works just fine, with the page displayed. I then add another template to the folder 'header.jet' and add the following to the top of register.jet

{{ include "./header.jet" }}

But if I reload the page, I get an error:

Jet Runtime Error ("/register":1): template /header.jet could not be found

I have tried various things such as addint the path, such as www/views/header.jet but cannot get it to work.

Thanks for any thoughts..

richp10 avatar Sep 27 '21 13:09 richp10

Hi @richp10, I had the same problem. You must enter a template name without .jet, for example {{ include "header" }}.

I know, it's not entirely intuitive, but it works.

martinjanda avatar May 18 '22 09:05 martinjanda

Hi @richp10, I had the same problem. You must enter a template name without .jet, for example {{ include "header" }}.

I know, it's not entirely intuitive, but it works.

This worked for me

BRUHItsABunny avatar May 28 '22 06:05 BRUHItsABunny