Possible to automatically generate link lists for menus and footer?

So I’m using the following in my config.rb to automatically generate pages for a variety of products defined in YAML files:

data.products.custom.each do |type, entry|
  proxy "/products/custom/#{type}/index.html", "templates/products/custom/template.html", :locals => { :entry => entry }, :ignore => true
end

Can anyone point me in the right direction as to how would I go further and automate the population of say menus and footers with these pages like this for example;

Home Products
     - custom entry 1
     - custom entry 2
     - custom entry 3
     - etc

Answered it myself in the question really.

<% data.products.custom.each do |type, entry| %>
    <li>(for example) /products/custom/<%= type %>/index.html</li>
<% end %>

Simple as that? Not sure what the ‘entry’ variable is for but it doesn’t break anything having it there so hey ho.

Yeah, simple as that! Pretty sure type returns the yaml filename in this case, entry the actual data.

2 Likes