Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equivalent for site.static_file in a loop #234

Closed
mittelgrau opened this issue Sep 17, 2018 · 6 comments
Closed

Equivalent for site.static_file in a loop #234

mittelgrau opened this issue Sep 17, 2018 · 6 comments

Comments

@mittelgrau
Copy link

mittelgrau commented Sep 17, 2018

Playing around with Eleventy and stumbled about finding a equivalent for this Jekyll/Liquid loop

{% for image in site.static_files %}
     <img src=""{{ image.url }}>
{% endfor %}

any quick hint where to look?

@kleinfreund
Copy link
Contributor

What do you expect site.static_files to contain?

You can use Data files or even JavaScript data files to provide your templates with additional data.

@mittelgrau
Copy link
Author

Group of images that are not part of a specific Blog post. But i will make sure to read through your links :)

@zachleat
Copy link
Member

This looks like what @mittelgrau is referencing: https://jekyllrb.com/docs/static-files/

I don’t believe that we’ll ever have this idea of static versus dynamic files because we decide what to process based on file extension, not on whether or not the file has front matter.

@kleinfreund is right that you can build an array of files using https://www.11ty.io/docs/data-js/ JavaScript Data Files to iterate over files in a directory.

Eventually we might be able to do this with #117 and data files to assign Tags to these new file types. But that’s later on.

Please reopen if you have more questions!

@kleinfreund
Copy link
Contributor

That said, pass-through files serve a similar if not the same purpose. We could make pass-through files available as an implicit collection.

@zachleat
Copy link
Member

We could make pass-through files available as an implicit collection.

Oh now there’s a very interesting idea indeed.

@zachleat
Copy link
Member

Opened as #237

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants