1. My Caddy version (caddy -version
):
Caddy 0.11.0 (+1f7b5ab Thu May 10 15:51:18 UTC 2018) (unofficial)
1 file changed, 1 insertion(+), 1 deletion(-)
caddy/caddymain/run.go
2. How I run Caddy:
a. System environment:
OS, relevant versions, systemd? docker? etc.
Ubuntu 18.04.3 LTS, systemd
3. The problem I’m having:
I would like to use Caddy’s Template function .Context.ListFiles
to order the results in user-controlled ways. For my specific current need, I’d like to order the files by date created, newest first.
4. Error messages and/or full log output:
No errors. It seems that .Context.ListFiles
doesn’t provide me any arguments or mechanisms to control the ordering of the list of files.
5. What I already tried:
I’ve tried
<ul>
{{range $name := .Context.Files "." }}
<li>{{ $name }}</li>
{{end}}
and that does give me a list of file names; but it doesn’t give me anything beyond the file name. So I am unable to sort the list by creation date.