Search code examples
javascriptdocpad

how to recursively create a tree of links to any files in a specific folder in docpad


I'm really new to docpad and would like to know how i can recursively create a tree of links to any files in a specific folder in docpad

Thanks


Solution

  • We can use the getFilesAtPath template helper. With eco it would look like this:

    <% for file in @getFilesAtPath('blah').toJSON(): %>
        <a href="<%= file.url %>"><%= file.name %></a>
    <% end %>