I’m new at Hugo, and I’m in the mid of porting all my site from wordpress to Hugo.
Is there any ways to limit the words of summaries ?
As the default is first 70 words, how if I want to make it less than that ?
The problem I faced right now is I the content from wordpress more tag is more than 70 words.
Haven’t done this myself, but how about using the string functions? It doesn’t seem possible to subtract the first 70 words from a string, but you can extract a certain amount of characters from the beginning of .Content it seems with slicestr.
There is no issues on the display but I’ve got an error link this: ERROR: 2016/09/16 14:26:32 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
What would that be ?
While on the code: <!--DETAILS--> <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>
Perhaps the .Summary of one of the posts was not 200 characters (an empty post), and with slicestr you tried to get the first 200 characters (which weren’t there).
If you check whether a post has a .Summary of at least 200 characters, does the error then go away?