diff options
author | Paul Duncan <pabs@pablotron.org> | 2021-10-16 10:08:47 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2021-10-16 10:08:47 -0400 |
commit | 0b92b5cd388cd62a5e59b45847b26095a093ad96 (patch) | |
tree | 447fbce22e6502fc9855d607ceef5ef5d60d7203 /themes | |
parent | 62c332b786fd6b849f1195e954b1e4ac715c4f30 (diff) | |
download | pablotron.org-0b92b5cd388cd62a5e59b45847b26095a093ad96.tar.bz2 pablotron.org-0b92b5cd388cd62a5e59b45847b26095a093ad96.zip |
hugo-pt2021: handle empty article list
Diffstat (limited to 'themes')
-rw-r--r-- | themes/hugo-pt2021/layouts/articles/list.html | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/themes/hugo-pt2021/layouts/articles/list.html b/themes/hugo-pt2021/layouts/articles/list.html index 8db3f26..f9c747b 100644 --- a/themes/hugo-pt2021/layouts/articles/list.html +++ b/themes/hugo-pt2021/layouts/articles/list.html @@ -3,6 +3,9 @@ {{- end -}} {{- define "main" -}} + {{/* get visible articles */}} + {{- $rows := union (where .Pages "Params.show" true) (where .Pages "Params.show" nil) -}} + <div class='container'> <div class='section is-small'> <h1 class='title' title='{{.Title}}' aria-label='{{.Title}}'> @@ -11,18 +14,18 @@ <div class='content'> <ul> - {{- range .Pages -}} - {{- if default true .Params.show -}} - <li> - <a - href='{{.Permalink}}' - title='{{.Title}}' - aria-label='{{.Title}}' - > - {{- .Title -}} - </a> - </li> - {{- end -}} + {{- range $rows.ByTitle -}} + <li> + <a + href='{{.Permalink}}' + title='{{.Title}}' + aria-label='{{.Title}}' + > + {{- .Title -}} + </a> + </li> + {{- else -}} + <li>No articles.</li> {{- end -}} </ul> </div><!-- content --> |