Most of Hugo’s default paths, like
<theme>/layouts/index.html, require the extension
.html. Most common IDEs and editors assume that files with an
.html extension are HTML and should be syntax-highlighted as such. (For example, this is true for Atom, VS Code, Sublime Text,
However, most of the time, your Hugo files are actually Go HTML templates, meaning that they’re not really HTML, but rather a mix of HTML and Go’s
html/template. That means that the Go template fragments won’t be identified correctly, since they aren’t part of HTML. Calling these files HTML seems not quite right, therefore.
Since the name of the template is arbitrary, is it possible to ask Hugo to look for an arbitrarily configurable list of names (rather than the
<theme>/layouts/index.html-style ordering), for purposes of identifying a suitable template to use in a given situation? The convention in other languages is to suffix the order of expected processing – e.g.,
index.html.go if it’s going to be processed by Go and then as HTML.