Error while reading a included file in FTL | Community
Skip to main content
October 16, 2015
Solved

Error while reading a included file in FTL

  • October 16, 2015
  • 4 replies
  • 1810 views

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.
Best answer by PaulMcMahon

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

Adobe Employee
October 16, 2015

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

Sham_HC
Level 10
October 16, 2015

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

PaulMcMahonAccepted solution
Level 8
October 16, 2015

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. 

October 16, 2015

we are using  Sling project's Freemarker scripting engine.