How to render a template inside a “web/templates/folder/subfolder”

See the pattern option to Phoenix.View, i.e. in your web.ex you can set:

use Phoenix.View, root: "web/templates", pattern: "**/*"

Which would then precompile all templates within the view’s folder as before, as well as all nested directories within the template folder.

29 Likes