Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/hivickylai/hugo-theme-sam.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huff <shuff@vecna.org>2018-05-01 14:05:54 +0300
committerSteve Huff <shuff@vecna.org>2018-05-01 14:05:54 +0300
commit2c06c00351863122ba8c63fcca50f2ed022100c6 (patch)
tree415813bae2c792ea23cf8bb551ede610ac3c2bfd /layouts
parentf305cd125db3e4fece61344cbdb6d0bcdec0a4cd (diff)
fix: allow only one mainMenu item
Currently the theme errors if there is only one item in `.Site.Params.mainMenu`, as follows: ``` Building sites … ERROR 2018/05/01 18:27:08 Error while rendering "taxonomyTerm" in "": template: theme/_default/list.html:7:9: executing "theme/_default/list.html" at <after 1 .Site.Params...>: error calling after: no items left ``` This change wraps that `range` in a conditional to ensure that it won't run if it would return zero lines.
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/list.html4
1 files changed, 3 insertions, 1 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 6a14f0f..d00d90f 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -4,6 +4,8 @@
{{ .Date.Format (.Site.Params.dateForm | default "Mon Jan 02, 2006")}} --
{{ end }}<a href="{{.Permalink}}">{{.Title}}</a></li>{{ end }}</div>{{ if .Site.Params.mainMenu }}<div class="section bottom-menu"><hr/><p>{{ range first 1 .Site.Params.mainMenu }}<a href="{{ .link }}">{{ .text }}</a>{{ end }}
+{{ if ( gt ( len .Site.Params.mainMenu ) 1 ) }}
{{ range after 1 .Site.Params.mainMenu }}
&#183; <a href="{{ .link }}">{{ .text }}</a>{{ end }}
-&#183; <a href="{{.Site.BaseURL}}">{{ .Site.Params.homepage }}</a></p></div>{{ end }}<div class="section footer">{{ partial "footer.html" . }}</div></div></body> \ No newline at end of file
+{{ end }}
+&#183; <a href="{{.Site.BaseURL}}">{{ .Site.Params.homepage }}</a></p></div>{{ end }}<div class="section footer">{{ partial "footer.html" . }}</div></div></body>