File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 279279 b .Assert (err , qt .IsNotNil )
280280 b .Assert (err .Error (), qt .Contains , "wrong number of args for string: want 1 got 0" )
281281}
282+
283+ func TestPartialWithoutSuffixIssue13601 (t * testing.T ) {
284+ t .Parallel ()
285+
286+ files := `
287+ -- hugo.toml --
288+ -- layouts/home.html --
289+ P1: {{ partial "p1" . }}
290+ P2: {{ partial "p2" . }}
291+ -- layouts/_partials/p1 --
292+ P1.
293+ -- layouts/_partials/p2 --
294+ P2.
295+ {{ return "foo bar" }}
296+
297+ `
298+
299+ b := hugolib .Test (t , files )
300+ b .AssertFileContent ("public/index.html" , "P1: P1.\n P2: foo bar" )
301+ }
Original file line number Diff line number Diff line change @@ -913,7 +913,7 @@ func (s *TemplateStore) extractInlinePartials() error {
913913 name := templ .Name ()
914914 if ! paths .HasExt (name ) {
915915 // Assume HTML. This in line with how the lookup works.
916- name = name + ".html"
916+ name = name + s . htmlFormat . MediaType . FirstSuffix . FullSuffix
917917 }
918918 if ! strings .HasPrefix (name , "_" ) {
919919 name = "_" + name
@@ -1092,6 +1092,12 @@ func (s *TemplateStore) insertTemplate2(
10921092 panic ("category not set" )
10931093 }
10941094
1095+ if category == CategoryPartial && d .OutputFormat == "" && d .MediaType == "" {
1096+ // See issue #13601.
1097+ d .OutputFormat = s .htmlFormat .Name
1098+ d .MediaType = s .htmlFormat .MediaType .Type
1099+ }
1100+
10951101 m := tree .Get (key )
10961102 nk := nodeKey {c : category , d : d }
10971103
@@ -1719,6 +1725,7 @@ func (s *TemplateStore) transformTemplates() error {
17191725 continue
17201726 }
17211727 if ! vv .noBaseOf {
1728+ // TODO(bep) I don't think this branch is ever called.
17221729 for vvv := range vv .BaseVariantsSeq () {
17231730 tctx , err := applyTemplateTransformers (vvv .Template , lookup )
17241731 if err != nil {
You can’t perform that action at this time.
0 commit comments