What does “crashes” mean in this context? I suspect that you mean that Hugo prints an error message and fails to (completely) render. If so, could you share the error message?
I suspect it might be due to the .Params.located front matter not defined for all content or not accessible in the current context. If that’s the case, you can use the isset function (see here) to first check whether that variable is there before trying to access it.
Thanks for your quick reply List passing a counter and a short url
like so… {{< ctest counter = “8” located = “explore\beaches” >}}
counter: {{ .Params.counter }}
located: {{ .Params.located }}
{{ range $index, $num := (seq .Params.counter) }}
img src=“explore\beaches\images{{ $num }}.jpg”
{{ end }}
WORKS BUT NO SHORT URL
WITH THIS
{{ range $index, $num := (seq .Params.counter) }}
img src="{{ .Params.located }}\images{{ $num }}.jpg"
{{ end }}
ADD THAT AND NO HTNML not produced
Except
ERROR 2017/03/23 04:08:54 error processing shortcode shortcodes/ctest.html
ERR: template: shortcodes/ctest.html:7:28: executing “shortcodes/ctest.html” at <.Params.located>: can’t evaluate field Params in type int
Like this … bulk resize some photos for a blog post called explore beaches
Bulk rename them in in Windows with F2 calling them all images
Use theBulkrname progarm to strip all the brackets and to change to lower case extension
Put images the static directory same name as blog post
In blog page if 8 photos I run a carousel this way… will give the code later
{{< ctest counter = “8” located = “explore” sublocated = “beaches” >}}
I also have another short code to add some txt with images for the blog
This is a very fast way to produce conetent from shorciode ctest.html img src="explore\beaches\images{{ $num }}.jpg WORKS
So I pas the count of files and the file names are auto generated for the carousel
img src="explore\beaches\images1.jpg"
img src=“explore\beaches\images2.jpg” etc
I can get this to work if i specify the directory
BUT Img src="{{ .Params.located }}{{ .Params.sublocated }}\images{{ $num }}.jpg"
but this fails with the error
at <.Params.located>: can’t evaluate field Params in type int
I solved this in the end by the following
{{ $jj := .Page.URL }}
{{ range $index, $num := (seq .Params.num) }}
div class=“carousel-item” img src="{{ $jj }}/images{{ $num }}.jpg">/div
{{ end }}
Using 32 bit version of Hugo who situation is hard to track down because Hugo gives different error messages.
Error reporting is overwritten or stack is confused.
Easy to find when making a shortcode page like this to test variable transfer to shortcodes…~
Gave inconsistent results!!! Bold is my stuff.
The site is called hothammok.com and page source shows the hugo partials as all modules have their name commentedstrong text
I hope that is of some interest in the scheme of things.
It is my first hugo site, now that the thing is working making significant layout changes is so fast.
Thanks again to the creator of Hugo and all those other contributors.
I may get inspired to make a page of my stumbling points along the way …
The design flow was not evident initially.