summaryrefslogtreecommitdiffstats
path: root/hugolib
diff options
context:
space:
mode:
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/template_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/hugolib/template_test.go b/hugolib/template_test.go
index eed3ee8ed..9cc523cb0 100644
--- a/hugolib/template_test.go
+++ b/hugolib/template_test.go
@@ -212,3 +212,27 @@ Some content
}
}
+
+// https://github.com/gohugoio/hugo/issues/4895
+func TestTemplateBOM(t *testing.T) {
+
+ b := newTestSitesBuilder(t).WithSimpleConfigFile()
+ bom := "\ufeff"
+
+ b.WithTemplatesAdded(
+ "_default/baseof.html", bom+`
+ Base: {{ block "main" . }}base main{{ end }}`,
+ "_default/single.html", bom+`{{ define "main" }}Hi!?{{ end }}`)
+
+ b.WithContent("page.md", `---
+title: "Page"
+---
+
+Page Content
+`)
+
+ b.CreateSites().Build(BuildCfg{})
+
+ b.AssertFileContent("public/page/index.html", "Base: Hi!?")
+
+}