How to create a nova template from a .dtl file

Hi,

I am following the nova book and created a controller+view and a new route.

On the first request to the new route the template file was compiled and rendered.

But on subsequent requests and after a new start (with rebar3 nova serve in dev mode), I

saw error messages:

=DEBUG REPORT==== 15-Jun-2026::05:06:57.605949 ===
Set state for plugin nova_request_plugin; NewState: #{}
=ERROR REPORT==== 15-Jun-2026::05:06:57.611317 ===
    reason: nofile
    msg: <<"Nova could not render template">>
    template: blog_profile_dtl
=ERROR REPORT==== 15-Jun-2026::05:06:57.611383 ===
    reason: {template_not_found,blog_profile_dtl}
    msg: <<"Controller threw an exception">>
    class: throw

Some questions on templates:

  • are templates compiled when a new template file is detected? or on demand at runtime?
  • are the compiled templates only contained in memory?
  • and, for my situation: what do i have to do to get and keep templates?

Definitely one time when templates are compiled is when a file modification is detected at runtime.

I guess that only works for the dev environment?

One use case now is:

  • i modifiy the .dtl file, nova compiles it, i can see the change in a browser
  • i restart the application, and the same request does not work

To answer my own question..

In rebar.config this helps a lot:

{provider_hooks, [
                  {pre, [
                         {compile, {erlydtl, compile}}
                        ]}
                  ]}.

maybe it could be added to rebar3_nova new?

Thank you. It might have been accidentally removed when I did some changes to template. I will add it.

Thank you for trying the book and ping me if you find more things.