ERROR: template.go:132: template: "theme/partials/head.html" is an incomplete or empty template

Hi gophers, I want your help…

I am blogging with hugo(https://ulgoon.github.io/).

I was trying to make another hugo project.

And, I built another project with hugo new site ~~

Then, I came back to blog project directory and run server with hugo server

with these errors…

ERROR: 2016/10/20 01:50:15 template.go:132: template: "theme/partials/head.html" is an incomplete or empty template; defined templates are: "_internal/disqus.html", "theme/partials/bloc/content/link-title.html", "theme/post/summary.boot.html", "theme/partials/bloc/content/h1-title.html", "_internal/opengraph.html", "theme/partials/modules/site/link/social/bitbucket.html",
...

almost every files are related with this error.

Is there anything I can do?

1 Like

Can you show us the contents of partials/head.html please? I’m guessing there is a curly missing or an unnecessary additional curly brace somewhere…

Sure, thanks!

Not only partials/head.html, almost every layout files are with this error.
I use hyde-y theme…

<!DOCTYPE html>
{{ "<!--[if lt IE 7]>" | safeHTML }} <html class="no-js lt-ie9 lt-ie8 lt-ie7"> {{ "<![endif]-->" | safeHTML }}
{{ "<!--[if IE 7]>" | safeHTML }} <html class="no-js lt-ie9 lt-ie8"> {{ "<![endif]-->" | safeHTML }}
{{ "<!--[if IE 8]>" | safeHTML }} <html class="no-js lt-ie9"> {{ "<![endif]-->" | safeHTML }}
{{ "<!--[if gt IE 8]><!-->" | safeHTML }} <html class="no-js"> {{ "<!--<![endif]-->" | safeHTML }}
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <title>{{ .Title }} {{ if ne .Title .Site.Title }} &middot; {{ .Site.Title }}{{ end }}</title>
  {{ partial "base/metas" . }}
  {{ partial "base/imports" . }}
  {{ partial "head-extra" . }}
</head>
<body{{ with .Site.Params.theme }} class="{{ . }}"{{ end }}>
  <main id="main-wrapper" class="container main_wrapper{{ with .Site.Params.sidebar }}{{ if and ( not ( eq . "" ) ) ( not ( eq . "false" ) ) }} has-sidebar{{ end }}{{ if eq . "right" }} right{{ end }}{{ end }}">
    {{ partial "base/header" . }}

I get the same error. But the strange thing is that the error is not on the Windows system. Just on the server running linux.

I cloned the source of @ulgoon’s website and started the built-in server - no errors occurred. I’m using Linux with Hugo v0.17.

Could you post the output of the hugo version command?

It was v0.18. Now I installed v0.17 and everything works fine. Thanks.

I use this version with MacOS Sierra v10.12.1

Hugo Static Site Generator v0.17 BuildDate: 2016-10-07T23:42:05+09:00

After deleting every hugo project even with hugo, it works fine.

but, I still don’t know why… ;;

I just had a similar error. ERROR: 2016/12/22 10:52:22 general.go:236: theme/partials/header-text-center.html is an incomplete or empty template

The offending line in my partial was <h1>{{ $.Params.header_text | safeHTML }}</h1>

The front matter for the page i’m working on doesn’t have any HTML in the header_text If I remove the safeHTML function from that line it works, but I do use safeHTML in this template and pass in HTML from front matter

Hugo Static Site Generator v0.18 BuildDate: 2016-12-21T10:20:23-05:00

I also realized there is this error. However, I use markdownify in a partial. It worked great and without errors on 0.16. The errors started to occur with 0.17. 0.18 also throws these.

This is my partial:

{{ .Site.Author.name | markdownify }}<br/>
{{ .Site.Author.sub | markdownify }}<br/>
{{ .Site.Author.company | markdownify }}<br/>
{{ .Site.Author.street }}<br/>
{{ .Site.Author.zip }} {{ .Site.Author.city }}<br/>
{{ .Site.Params.config.phoneicon | markdownify }} {{ .Site.Author.phone }}<br/>
{{ .Site.Params.config.faxicon | markdownify }} {{ .Site.Author.fax }}<br/>
{{ .Site.Params.config.emailicon | markdownify }} {{ .Site.Author.email | markdownify }}

It makes no difference whether I use markdownify or safeHTML with respect to the error, ie the following gives the same error:

{{ .Site.Author.name | safeHTML }}<br/>
{{ .Site.Author.sub | safeHTML }}<br/>
{{ .Site.Author.company | safeHTML }}<br/>
{{ .Site.Author.street }}<br/>
{{ .Site.Author.zip }} {{ .Site.Author.city }}<br/>
{{ .Site.Params.config.phoneicon | safeHTML }} {{ .Site.Author.phone }}<br/>
{{ .Site.Params.config.faxicon | safeHTML }} {{ .Site.Author.fax }}<br/>
{{ .Site.Params.config.emailicon | safeHTML }} {{ .Site.Author.email | safeHTML }}

I am on Windows and using hugo as 64bit:

Hugo Static Site Generator v0.18 BuildDate: 2016-12-29T20:13:13+01:00
Hugo Static Site Generator v0.17 BuildDate: 2016-11-07T12:48:49+01:00
Hugo Static Site Generator v0.16 BuildDate: 2016-08-11T14:40:57+02:00

Hence, I suspect something has changed starting with version 0.17.