dntzbgh
December 18, 2021, 2:10pm
1
Hello,
I’m trying to create an array of all the CSS and JS resources in the head of my page, for example:
slice (resources.Get "assets/css/bootstrap.css") (resources.Get "assets/css/bootstrap.css")
but since I will have many files, I want to be able to use the slice function over multiple lines:
slice
(resources.Get "assets/css/bootstrap.css")
(resources.Get "assets/css/bootstrap.css")
...
is it possible?
I know that you can do that with strings, but I don’t know if its the same.
dntzbgh
December 18, 2021, 3:36pm
3
I’m trying to do it like this:
{{ $ceva:=slice
(resources.Get "assets/css/bootstrap.css")
(resources.Get "assets/css/bootstrap.css") }}
{{$ceva}}
{{range $ceva}}
<link href="{{.Permalink}}" rel="stylesheet" type="text/css" media="all">
{{end}}
but I get
parse failed: template: partials/head.html: 14: unclosed action
where line 14 is the first line in the code above
Version? The ability to include newlines in template actions and commands was introduced with v0.81.0. The current release is v0.91.0.
https://github.com/gohugoio/hugo/releases/tag/v0.91.0
1 Like
dntzbgh
December 18, 2021, 4:17pm
5
You are right, with the latest version is working. It seems I had an older version.
Thanks
system
Closed
December 20, 2021, 4:18pm
6
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.