summaryrefslogtreecommitdiffstats
path: root/docs/layouts/shortcodes
diff options
context:
space:
mode:
authorMark D. Blackwell <markdblackwell01@gmail.com>2016-09-10 18:23:23 -0400
committerdigitalcraftsman <digitalcraftsman@protonmail.com>2016-09-15 15:15:04 +0200
commit0d1e96701fd3907d0a3e15e068925fe42ba3f662 (patch)
treee9ca13779245818e0cd755e7a49cd1d341309908 /docs/layouts/shortcodes
parentb86a605bfb14450d56f4e7faeb4fc5fa8c936438 (diff)
docs: Improve Traversing Local Files
Diffstat (limited to 'docs/layouts/shortcodes')
-rw-r--r--docs/layouts/shortcodes/directoryindex.html13
-rw-r--r--docs/layouts/shortcodes/fileindex.html16
-rw-r--r--docs/layouts/shortcodes/readfile.html1
3 files changed, 14 insertions, 16 deletions
diff --git a/docs/layouts/shortcodes/directoryindex.html b/docs/layouts/shortcodes/directoryindex.html
new file mode 100644
index 000000000..02a4efadc
--- /dev/null
+++ b/docs/layouts/shortcodes/directoryindex.html
@@ -0,0 +1,13 @@
+{{- $pathURL := .Get "pathURL" -}}
+{{- $path := .Get "path" -}}
+{{- $files := readDir $path -}}
+<table>
+ <th>Size in bytes</th>
+ <th>Name</th>
+{{- range $files }}
+ <tr>
+ <td>{{ .Size }}</td>
+ <td><a href="{{ $pathURL }}{{ .Name | relURL }}"> {{ .Name }}</a></td>
+ </tr>
+{{- end }}
+</table>
diff --git a/docs/layouts/shortcodes/fileindex.html b/docs/layouts/shortcodes/fileindex.html
deleted file mode 100644
index 26b903f6a..000000000
--- a/docs/layouts/shortcodes/fileindex.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<table style="width=100%">
-<th>Size in bytes</th>
-<th>Name</th>
-{{$dir := .Get "dir"}}
-{{ $url := .Get "baseurl" }}
-
-{{ $files := readDir $dir }}
- {{ range $files }}
- <tr>
- <td>{{.Size}}</td>
- <td>
- <a href="{{$url}}{{.Name | urlize }}"> {{.Name}}</a>
- </td>
- </tr>
- {{ end }}
-</table>
diff --git a/docs/layouts/shortcodes/readfile.html b/docs/layouts/shortcodes/readfile.html
new file mode 100644
index 000000000..f5b3459bf
--- /dev/null
+++ b/docs/layouts/shortcodes/readfile.html
@@ -0,0 +1 @@
+{{- .Get 0 | readFile -}}