Stream: IG creation
Topic: Jekyll help needed
Jose Costa Teixeira (Feb 18 2021 at 20:52):
Is there a way to tell Dr Jekyll this?
{% assign filename = site.data.whatever.variable.i.want %}
{% if exists {{ filename | downcase }} %}
<p>File exists</p>
{% else %}
<p> No file here</p>
{% endif %}
Lloyd McKenzie (Feb 18 2021 at 21:03):
I think you just skip the double-braces?
Jose Costa Teixeira (Feb 18 2021 at 21:15):
if I do this
{% if exists filename %}
I get this exception
Unknown operator filename
Lloyd McKenzie (Feb 18 2021 at 21:32):
@Eric Haas
Jose Costa Teixeira (Feb 19 2021 at 20:42):
seems the issue is finding if a file exists. @Eric Haas do you know if that is possible?
Eric Haas (Feb 19 2021 at 21:51):
I could never figure how to check if file exists in Jekyll/liquid. for some files types like fixed assets you can, but never found it very useful.
Eric Haas (Feb 19 2021 at 21:52):
see https://stackoverflow.com/questions/16528783/check-for-existence-of-file-using-jekyll
Eric Haas (Feb 19 2021 at 21:55):
It would be easier to cycle through the ig resource for pages or one of the site variables or created your own list of files in the data directory.
Jose Costa Teixeira (Feb 20 2021 at 00:18):
Thanks
Last updated: Apr 12 2022 at 19:14 UTC