diff options
Diffstat (limited to 'layouts/_partials')
| -rw-r--r-- | layouts/_partials/articles/header.html | 8 | ||||
| -rw-r--r-- | layouts/_partials/asset-table.html | 2 | ||||
| -rw-r--r-- | layouts/_partials/assets.html | 2 | ||||
| -rw-r--r-- | layouts/_partials/pages.html | 26 | ||||
| -rw-r--r-- | layouts/_partials/taxonomy-url.html | 11 | ||||
| -rw-r--r-- | layouts/_partials/terms.html | 18 |
6 files changed, 57 insertions, 10 deletions
diff --git a/layouts/_partials/articles/header.html b/layouts/_partials/articles/header.html deleted file mode 100644 index e415b89..0000000 --- a/layouts/_partials/articles/header.html +++ /dev/null @@ -1,8 +0,0 @@ -<h1 class="title">{{ .Title }}</h1> -<p> - {{- partial "date.html" .Date -}} - {{- if gt .Lastmod .Date -}} - — modified {{ partial "date.html" .Lastmod }} - {{- end -}} -</p> -<hr> diff --git a/layouts/_partials/asset-table.html b/layouts/_partials/asset-table.html index d5e893c..df47501 100644 --- a/layouts/_partials/asset-table.html +++ b/layouts/_partials/asset-table.html @@ -6,7 +6,7 @@ have a corresponding .moddate file, e.g., assets/foo/bar.txt and assets/foo/bar.txt.moddate containing "1999-01-02". This is to preserve the modification times of files when the repository is cloned. -@context {.} resource.Resources +@context {resource.Resources} . @example: {{ partial "asset-table.html" (resources.Match "spreadsheets/*.ods") }} */}} diff --git a/layouts/_partials/assets.html b/layouts/_partials/assets.html index 6930496..8bb5d2a 100644 --- a/layouts/_partials/assets.html +++ b/layouts/_partials/assets.html @@ -1,7 +1,7 @@ {{- /* Render a list of tables of assets. -@context {.} dict Mapping from section titles to asset glob patterns. +@context {dict} . Mapping from section titles to asset glob patterns. @examle: {{ partial "assets.html" (dict "Spreadsheets" "auto/*.ods") }} */}} diff --git a/layouts/_partials/pages.html b/layouts/_partials/pages.html new file mode 100644 index 0000000..6a7dc16 --- /dev/null +++ b/layouts/_partials/pages.html @@ -0,0 +1,26 @@ +{{- /* +Renders a table of pages. + +@context {Page} . Current page. + +@example: {{ partial "page-list.html" .Pages }} +*/}} + +<table> + <thead> + <tr> + <th>Date</th> + <th>Title</th> + <th><a href="{{ partial "taxonomy-url.html" (dict "taxonomy" "tags" "site" .Site) }}">Tags</a></th> + </tr> + </thead> + <tbody> + {{- range .Pages }} + <tr> + <td>{{ partial "date.html" .Date -}}</td> + <td><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></td> + <td>{{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}</td> + </tr> + {{- end }} + </tbody> +</table> diff --git a/layouts/_partials/taxonomy-url.html b/layouts/_partials/taxonomy-url.html new file mode 100644 index 0000000..259cc9b --- /dev/null +++ b/layouts/_partials/taxonomy-url.html @@ -0,0 +1,11 @@ +{{- /* +Renders the URL of a taxonomy page. + +@context {string} taxonomy Name of the taxonomy. +@context {site} site The site. + +@example: <a href="{{ partial "taxonomy-url.html" (dict taxonomy "tags" "site" .Site }}">tags</a> +*/}} + +{{- $taxonomy := index .site.Taxonomies .taxonomy -}} +{{- $taxonomy.Page.RelPermalink -}} diff --git a/layouts/_partials/terms.html b/layouts/_partials/terms.html new file mode 100644 index 0000000..afe3a14 --- /dev/null +++ b/layouts/_partials/terms.html @@ -0,0 +1,18 @@ +{{- /* +For a given taxonomy, renders a comma-separated list of terms assigned to the page. + +@context {string} taxonomy The taxonomy. +@context {page} page The current page. + +@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} +*/}} + +{{- $taxonomy := .taxonomy }} +{{- $page := .page }} + +{{- with $page.GetTerms $taxonomy -}} + {{- range $index, $term := . -}} + {{- if $index }}, {{ end -}} + <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> + {{- end -}} +{{- end -}} |