liquid - Check for existence of file using Jekyll -


how can use jekyll test existence of file?

to clarify, want run {% if %} statement check if image file exists same name page on.

on page in yaml front matter:

----   reference-design: true ---- 

in layout:

{% if page.reference-design %}     {% assign filename = page.path | remove_first: '.html' %}     <!-- how can check if file exists? -->     <img src="images/reference_designs/{{ filename }}.png"> {% endif %} 

as of jekyll 2, site files available via site.static_files. can use check if file exists. example:

{% static_file in site.static_files %}     {% if static_file.path == '/favicon.ico' %}         {% assign favicon = true %}     {% endif %} {% endfor %} 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -