diff options
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_partials/asset_table.html | 32 | ||||
| -rw-r--r-- | layouts/auto/page.html | 6 | ||||
| -rw-r--r-- | layouts/list.html | 2 | ||||
| -rw-r--r-- | layouts/term.html | 7 |
4 files changed, 39 insertions, 8 deletions
diff --git a/layouts/_partials/asset_table.html b/layouts/_partials/asset_table.html new file mode 100644 index 0000000..116b22d --- /dev/null +++ b/layouts/_partials/asset_table.html @@ -0,0 +1,32 @@ +{{- /* +For a given collection of global resources, render a table with +the modification date of each resource and a link to the resource. +The resources must be from the assets/ directory in order to get their +modification times. + +@context {,} resource.Resources + +@example: {{ partial "asset_table.html" (resources.Match "spreadsheets/*.ods") }} +*/}} + +<table> + <thead> + <tr> + <th>Mod. date</th> + <th>File</th> + </tr> + </thead> + <tbody> + {{ range . }} + {{- $fpath := printf "assets/%s" .Name -}} + <tr> + <td> + {{- with os.Stat $fpath -}} + {{- .ModTime | time.Format "2006-01-02" -}} + {{- end -}} + </td> + <td><a href="{{ .RelPermalink }}">{{ path.Base .Name }}</a></td> + </tr> + {{- end }} + </tbody> +</table> diff --git a/layouts/auto/page.html b/layouts/auto/page.html new file mode 100644 index 0000000..eaa06d7 --- /dev/null +++ b/layouts/auto/page.html @@ -0,0 +1,6 @@ +{{ define "main" }} + <h1 class="title">{{ .Title }}</h1> + {{ .Content }} + <h1>Spreadsheets</h1> + {{- partial "asset_table.html" (resources.Match "auto/*.ods") }} +{{ end }} diff --git a/layouts/list.html b/layouts/list.html index cc6c7be..edee471 100644 --- a/layouts/list.html +++ b/layouts/list.html @@ -1,5 +1,5 @@ {{ define "main" }} - <h1>{{ .Title }}</h1> + <h1 class="title">{{ .Title }}</h1> <table> <thead> <tr> diff --git a/layouts/term.html b/layouts/term.html deleted file mode 100644 index c2e7875..0000000 --- a/layouts/term.html +++ /dev/null @@ -1,7 +0,0 @@ -{{ define "main" }} - <h1>{{ .Title }}</h1> - {{ .Content }} - {{ range .Pages }} - <h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2> - {{ end }} -{{ end }} |