commit f5c7ac1d949153959b19a97e200cd24014fcfa90 parent 33c1bbf4978b436b41d86466c8cacfde24a0f484 Author: Luís Ferreira <[email protected]> Date: Mon, 9 Aug 2021 21:23:35 +0100 layouts: add list-files shortcode Signed-off-by: Luís Ferreira <[email protected]> Diffstat:
A | layouts/shortcodes/list-files.html | | | 9 | +++++++++ |
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/layouts/shortcodes/list-files.html b/layouts/shortcodes/list-files.html @@ -0,0 +1,9 @@ +{{ $dir := .Get "dir" }} +{{ $regexp := .Get "regexp" }} + +{{ range sort (readDir (delimit (slice "static" $dir) "/")) "Name" }} + {{ if (findRE $regexp .Name) }} + <a href="{{ $dir }}/{{ .Name }}">{{ .Name }}</a> + {{ end }} +{{ end }} +