@marcel91200 / caddy Mirror · read-only / commits / 4ba16fe8
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 11, 11:00 UTC

docs: add documentation for fileExists and fileStat template functions (#7700)

Steffen Busch committed May 11, 2026 at 20:23 UTC 4ba16fe82c9dbf8affb670dc56f7c43f1296e3e9
1 file changed +19
modules/caddyhttp/templates/templates.go
+19
@@ -162,6 +162,25 @@ func init() {
162 // {{listFiles "/mydir"}}
163 // ```
164 //
165 +// ##### `fileExists`
166 +//
167 +// Returns true if the given file name, relative to the template context's file root,
168 +// can be opened successfully.
169 +//
170 +// ```
171 +// {{fileExists "path/to/file.html"}}
172 +// ```
173 +//
174 +// ##### `fileStat`
175 +//
176 +// Returns [FileInfo](https://pkg.go.dev/io/fs#FileInfo) using [Stat](https://pkg.go.dev/io/fs#Stat)
177 +// on the given file name, relative to the template context's file root.
178 +//
179 +// ```
180 +// {{$css := fileStat "css/style.css" -}}
181 +// <link rel="stylesheet" href="/css/style.css?v={{ $css.ModTime.Unix }}">
182 +// ```
183 +//
184 // ##### `markdown`
185 //
186 // Renders the given Markdown text as HTML and returns it. This uses the