Hugo needs empty tag {{}} to process html files correctly

I’m moving a static site to Hugo, no markdown (yet), just HTML.

Now, I have created a layouts/_default/single.html template which applies a common header and a footer.

This does not work with html files in the content folder, UNLESS I put an empty directive {{}} at the beginning of the html file - only then Hugo starts apllying template to the files. Should I report this as a bug?

You can try, but I don’t think we can fix it without breaking lots of glass.

So the logic is:

  • Pages with with front matter gets a layout.
  • Pages without front matter is its own layout.

So the “empty tags” you refer to is JSON frontmatter start/end, so to speak.

You can do similar with TOML and YAML delimiters, and you can wrap them in HTML comment tags so they don’t mess with your editor etc …