mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
b9bd35d72e
git-subtree-dir: docs git-subtree-split: fdea5430f89dfd849d39212abdf5ace0a4763e5a
743 B
743 B
title | linktitle | date | description | godocref | publishdate | lastmod | categories | menu | signature | workson | hugoversion | relatedfuncs | deprecated | aliases | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fileExists | fileExists | 2017-08-31T22:38:22+02:00 | Checks whether a file exists under the given path. | 2017-08-31T22:38:22+02:00 | 2017-08-31T22:38:22+02:00 |
|
|
|
false |
fileExists
allows you to check if a file exists under a given path, e.g. before inserting code into a template:
{{ if (fileExists "static/img/banner.jpg") -}}
<img src="{{ "img/banner.jpg" | absURL }}" />
{{- end }}
In the example above, a banner from the static
folder should be shown if the given path points to an existing file.