How to load templates from subdirectories in Phoenix

If you want or need to organize templates in subfolders within your view directory, those are not compiled by default. But doing that is simple as Chris McCord pointed out himself. Just enhance the use of Phoenix.View with pattern: "**/*":

  use Phoenix.View,
    root: "lib/my_app_web/templates",
    namespace: MyAppWeb,
    pattern: "**/*"

That way you can render tempaltes using subdirectories as you would expect:

render("subfolder/file.html")