11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.

Home Page:https://www.11ty.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to output on a page some files which are in a directory?

rocc-o opened this issue · comments

I have some .njk files in a directory which I'd like to output on a page - a list of these files

./directory/
index.njk
page1.njk
page2.njk
page3.njk

and I'd like these .njk files have the link to their URLs

How can I do that?

I think easiest solution is probably add a “directory.json” file which sets a custom tag which will auto create a collection which you can loop over to display urls or front after data.

Yes! It works! Thank you!