I also like using the view module for doing that kind of stuff, which allows my templates to need less amount of logic. They just display what’s given.
def render("myview.html", assigns) do
country_name = assigns.company[:country][:name] || "Unavailable"
render_template("myview.html", Map.merge(assigns, %{country_name: country_name}
end


















