Reputation: 6842
I am getting this error in a Hugo theme and have modified the code to use a simple example from the Hugo documentation and still get an error.
unexpected "=" in operand
Hugo Version
Hugo Static Site Generator v0.40.1 linux/amd64 BuildDate: 2018-04-25T17:16:11Z
Go Version
go version go1.12 linux/amd64
I have copied this code directly from the GoHugo - Append example.
Error
ERROR 2019/03/11 09:24:53 theme/partials/work.html : template: theme/partials/work.html:3: unexpected "=" in operand
Simplified Template
{{ partial "global-header.html" . }}
{{ $s := slice "a" "b" "c" }}
{{ $s = $s | append "d" "e" }}
<h1>David</h1>
I originally got the error in the Hugo AirSpace template at line 13 of the work.html partial.
Sample Line
{{ $categories = $categories | append .category }}
Full Template
{{ partial "global-header.html" . }}
<!-- Portfolio Start -->
<section id="portfolio-work">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="block">
<div class="portfolio-menu">
<ul>
{{ $categories := slice }}
{{ range .Site.Data.work.portfolio }}
{{ $categories = $categories | append .category }}
{{ end }}
<li class="filter" data-filter="all">Everything</li>
{{ range ( $categories | uniq ) }}
<li class="filter" data-filter=".{{ . }}">{{ . }}</li>
{{ end }}
</ul>
</div>
<div class="portfolio-contant">
<ul id="portfolio-contant-active">
{{ range .Site.Data.work.portfolio }}
<li class="mix {{ .category }}">
<a class="venobox" href="{{ $.Site.BaseURL }}{{ .image }}">
<img class="img-responsive" src="{{ $.Site.BaseURL }}{{ .image }}" />
<div class="overly">
<div class="position-center">
<i class="fa fa-search fz-20"></i>
<h2>{{ .name }}</h2>
<p>{{ .description }}</p>
</div>
</a>
</li>
{{ end }}
</ul>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Clients Logo Section Start -->
<section id="clients-logo-section">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="block">
<div id="clients-logo" class="owl-carousel">
{{ range .Site.Data.work.clients }}
<div class="clients-logo-img">
<a href="{{ .url }}"><img src="{{ $.Site.BaseURL }}{{ .image }}" alt="Features"></a>
</div>
{{ end }}
</div>
</div>
</div>
</div>
</div>
</section>
Upvotes: 0
Views: 4740
Reputation: 6842
I found that my version of go was old and it needed updating to 1.11
I followed the instructions found here
I had one slight variation, I used Go1.12 instead of 1.11
# From the docs
sudo tar -xvf go1.11.linux-amd64.tar.gz
# This is the latest version when I updated
sudo tar -xvf go1.12.linux-amd64.tar.gz
I also had to update my version of hugo.
Any time I did the following
sudo apt-get install hugo
I ended up with version 40
I followed the instructions here to go to version 53 of GO
Upvotes: 1