Skip to main content
Oct 16, 2015 2:27 AM UTC
Solved

Error while reading a included file in FTL

Hi, i am trying to include a html file in the FTL. it is giving 

 Error reading included file content/www/us/en/x/y/jcr:content/rr.html
The problematic instruction:
----------
==> include "${model.privacyPolicyPath}" [on line 50, column 23 in /apps/x/xx/xxx/xxxx/content/legalagreement/er.ftl]


     freemarker.template.TemplateException: Error reading included file content/www/us/en/as/asd/jcr:content/rr.html

please provide your inputs.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
PaulMcMahonAccepted solution
Level 8
Oct 16, 2015 2:27 AM UTC

I am not a Freemarker expert but my understanding is that include directive is only applicable for including another Freemarker template, not for including an resource like a HTML page. According to this (http://freemarker.org/docs/app_faq.html#faq_servlet_include) you have to use the include_page directive, however that directive is dependent on use of the FreemarkerServlet, which doesn't apply if you are using a Scripting Engine implementation of Freemarker. Are you using the Sling project's Freemarker scripting engine or something custom. 

4 replies

Oct 16, 2015 2:27 AM UTC

we are using  Sling project's Freemarker scripting engine.

Translate
PaulMcMahonAccepted solution
Level 8
Oct 16, 2015 2:27 AM UTC

I am not a Freemarker expert but my understanding is that include directive is only applicable for including another Freemarker template, not for including an resource like a HTML page. According to this (http://freemarker.org/docs/app_faq.html#faq_servlet_include) you have to use the include_page directive, however that directive is dependent on use of the FreemarkerServlet, which doesn't apply if you are using a Scripting Engine implementation of Freemarker. Are you using the Sling project's Freemarker scripting engine or something custom. 

Translate
Sham_HC
Level 10
Oct 16, 2015 2:27 AM UTC

Seems like slash (/) is missing at the beginning.

Translate
Adobe Employee
Oct 16, 2015 2:27 AM UTC

Does the node at "/content/www/us/en/as/asd/jcr:content/rr.html" actually exist?

Translate