Hello,
I have the following code in my html and I am trying to make it so that I am able to change the color of only one of the words that gets returned from the partial call {{ .heading }}. How should I go about changing this so I am able to split the sentence returned by the call?
<div class="heading">
<h1>{{ .heading }} </h1>
<p>{{ .subheading }}</p>
</div>
Thanks.
Do you mean this?
{{ $text := .heading }}
{{ ... use hugo string functions on $text ... }}
<div class="heading">
<h1>{{ $text }} </h1>
<p>{{ .subheading }}</p>
</div>
Wait one more thing, how do you call a function on the result of another function? I tried to do it as so but my code throws an error.
{{ $start := {{ substr $text 0 16 }}}}
Thanks
The braces open and close template code, not just function calls.
{{ $start := substr $text 0 16 }}
You can also combine function calls, e.g.
{{ $start := index (substr $text 0 16) 1 }}