Rendering partials in subdirectories

I have a section of my layout html designated as the header. It has a header tag, which contains the app title, an icon and dropdown for messages / notifications / tasks / settings. I’ve moved this html to a partial _header.html.eex and created partials for the other parts: _messages.html.eex, _notifications.html.eex, _tasks.html.eex, etc. The _header.html.eex partial renders the other header partials. This works fine.

Now I want to move all of that to a headers/ subdirectory since they’re all related to the header. Rendering from my layout now looks like this:

<%= render "headers/_header.html" %>

However, I’m now getting this error:

** (exit) an exception was raised: ** (Phoenix.Template.UndefinedError) Could not render "header/_header.html" for MyApp.LayoutView, please define a matching clause for render/2 or define a template at "web/templates/layout".

Any ideas?

1 Like

Yeah, can’t do it:

1 Like

Okay thanks for the info. I thought about using a prefix too…