You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to slice the .Summary I've got the error like this: y 3 ...>: error calling slicestr: slice bounds out of range in theme/partials/blog.html ERROR: 2016/09/17 22:32:13 template.go:131: template: theme/partials/blog.html:39:34: executing "theme/partials/blog.html" at <slicestr .Summary 3 ...>: error calling slicestr: slice bounds out of range in theme/partials/blog.html ERROR: 2016/09/17 22:32:13 template.go:131: template: theme/partials/blog.html:39:34: executing "theme/partials/blog.html" at <slicestr .Summary 3 ...>: error calling slicestr: slice bounds out of range in theme/partials/blog.html
And my code is: <div class="content"> <ol class="breadcrumb"> {{ if isset .Params "categories" }} {{ if gt (len .Params.categories) 0 }} in <a href="{{ $.Site.BaseURL }}categories/{{ index .Params.categories 0 | urlize | lower }}">{{ index .Params.categories 0 }}</a></li> {{ end }} {{ end }} </ol> <h6><a href="{{ .Permalink }}">{{ .Title }}</a></h6> <p> {{slicestr .Summary 3 200}} </p> <a href="{{ .Permalink }}">Read More</a> </div>
Is this known error ?
The text was updated successfully, but these errors were encountered:
I'm assuming your summary is less than 200 words. This is a bug in your template, not Hugo. Try slicestr without a limit, check the len of the result, then make the summary the first X where X is len or 200, whichever is smaller. Continue the conversation in the forums.
Hi,
When I try to slice the .Summary I've got the error like this:
y 3 ...>: error calling slicestr: slice bounds out of range in theme/partials/blog.html ERROR: 2016/09/17 22:32:13 template.go:131: template: theme/partials/blog.html:39:34: executing "theme/partials/blog.html" at <slicestr .Summary 3 ...>: error calling slicestr: slice bounds out of range in theme/partials/blog.html ERROR: 2016/09/17 22:32:13 template.go:131: template: theme/partials/blog.html:39:34: executing "theme/partials/blog.html" at <slicestr .Summary 3 ...>: error calling slicestr: slice bounds out of range in theme/partials/blog.html
And my code is:
<div class="content"> <ol class="breadcrumb"> {{ if isset .Params "categories" }} {{ if gt (len .Params.categories) 0 }} in <a href="{{ $.Site.BaseURL }}categories/{{ index .Params.categories 0 | urlize | lower }}">{{ index .Params.categories 0 }}</a></li> {{ end }} {{ end }} </ol> <h6><a href="{{ .Permalink }}">{{ .Title }}</a></h6> <p> {{slicestr .Summary 3 200}} </p> <a href="{{ .Permalink }}">Read More</a> </div>
Is this known error ?
The text was updated successfully, but these errors were encountered: