Phonenix template showing data from nested map

I have the following structure of data to be passed in HTML template

I wanted to display the movie name with all torrents info like URL, size etc. (right now only showing movie name, as I am learning the template system of phoenix)

defmodule WebmoviematchWeb.TorrentMoviesController do
 use WebmoviematchWeb, :controller

 def torrent_movies(conn, _params) do
    torrent = %{"url" => "torrent-url", "size" => "1 GB", "quality" => "1080p"}
    movies = %{"name" => "movie-name", "torrents" => [torrent]}
    render(conn, "index.html", "torrent_movies": [movies])

and template code looks like

<!DOCTYPE html>
<%, fn(item) -> %>
  <%= Map.fetch!(item, "name") %>
<% end) %>

But the template is blank, even not showing the movie info.

You’re missing <%= before

1 Like

Thanks @stefanchrobot