Error in build when hitting dynamic page template - undefined method '[]' for nil:NilClass

Hey, I’m new to middleman and ruby; fumbled my way through dynamic pages today and am running into an issue when I run middleman build. Everything works fine in localhost.

The error says "undefined method '[]' for nil:NilClass" when it tries to build the template file I’m using for my dynamic pages, followed by a whole lot of stuff I don’t understand :confused: I think this is the most relevant part as it calls out the template file name (I removed the path for this post):

/groups/gt.html.erb:2:in `block in singleton class'
/groups/gt.html.erb:131066:in `instance_eval'
/groups/gt.html.erb:131066:in `singleton class'
/groups/gt.html.erb:131064:in `__tilt_16951464'

Below are details on how my file is set up - thanks in advance to anyone who can help me understand what in tarnation is happening here.

I have a JSON file (allgroups.json) in the data directory that contains all the content for the dynamic pages I’m trying to build out. As an example, here is the structure:

{
  "groups" : [
    { 
      "slug":"slug", 
      "description" : "this is my description",
      "priorities" : [ 
        "one", 
        "two", 
        "three"
        ]
    },    
    { 
      "slug":"slug2", 
      "description" : "this is another description",
      "priorities" : [ 
        "one", 
        "two", 
        "three"
        ]
    }  
  ]
}

In config.rb I have:

data.allgroups.groups.each do |h|
  proxy "/groups/#{h.slug}.html", "/groups/gt.html", :locals => { :group => h }
end

Then in gt.html I have this :

    <% h = locals[:group] %>
    <div class="gt<%= h[:slug] %>">
        <div class="gt-section">
            <section class="main">
                <p class="description"><%= h[:description] %></p>
                <a class="huiNav" href="">Back to group list</a>
                <a class="huiNav" href="">Next</a>
            </section>
        </div>    
            <div class="details">
                <ul>
                    <% h[:priorities].each do |p| %>
                          <li>
                                  <%= p %>
                          </li>
                    <% end %>
                </ul>
            </div>
</div>

Duh. The answer was right in the docs - the error was happening because it was trying to build out my template file, rather than only the proxy pages. Had to add

:ignore => true 

to config.