I have several apps with something like the following in the app.html.eex or app.html.heex:
<%= render_existing(view_module(@conn), "_meta." <> view_template(@conn), assigns)
|| render AppWeb.LayoutView, "_meta.html", assigns %>
This setup renders the metadata for a given view “foo.html” by looking for “_meta.foo.html” and rendering it if it exists. I use the meta templates for holding SEO-related meta, OG meta, and various other tags that go into the tag of a document.
If meta doesn’t exist, then the logic above renders a default template called layout/_meta.html. as the default source.
After upgrading Phoenix, I’m now seeing a compilation warning telling me to use function_exported?/3 instead of render_existing/3.
warning: Phoenix.View.render_existing/3 is deprecated. Use function_exported?/3 instead
lib/app_web/templates/layout/app.html.eex:2: AppWeb.LayoutView."app.html"/1
What would be a good way of following this advice (without breaking the behavior of 100+ _meta templates)? There’s a considerable gap in the interface of the suggested replacement function.






















