mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-28 22:50:35 +03:00
parent
9221cbca49
commit
c19f1f2363
2 changed files with 23 additions and 1 deletions
|
@ -194,3 +194,23 @@ Home.
|
||||||
b.AssertFileContent("public/index.html", "layouts/baseof.html")
|
b.AssertFileContent("public/index.html", "layouts/baseof.html")
|
||||||
b.AssertFileContent("public/amp/index.html", "layouts/baseof.amp.html")
|
b.AssertFileContent("public/amp/index.html", "layouts/baseof.amp.html")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAllVsAmp(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- hugo.toml --
|
||||||
|
-- content/_index.md --
|
||||||
|
---
|
||||||
|
title: "Home"
|
||||||
|
outputs: ["html", "amp"]
|
||||||
|
---
|
||||||
|
title: "Home"
|
||||||
|
-- layouts/all.html --
|
||||||
|
All.
|
||||||
|
|
||||||
|
`
|
||||||
|
b := hugolib.Test(t, files)
|
||||||
|
b.AssertFileContent("public/index.html", "All.")
|
||||||
|
b.AssertFileContent("public/amp/index.html", "All.")
|
||||||
|
}
|
||||||
|
|
|
@ -92,6 +92,7 @@ func (this TemplateDescriptor) doCompare(category Category, other TemplateDescri
|
||||||
if other.Kind != "" && other.Kind != this.Kind {
|
if other.Kind != "" && other.Kind != this.Kind {
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
|
|
||||||
if other.Layout != "" && other.Layout != layoutAll && other.Layout != this.Layout {
|
if other.Layout != "" && other.Layout != layoutAll && other.Layout != this.Layout {
|
||||||
if isLayoutCustom(this.Layout) {
|
if isLayoutCustom(this.Layout) {
|
||||||
if this.Kind == "" {
|
if this.Kind == "" {
|
||||||
|
@ -108,6 +109,7 @@ func (this TemplateDescriptor) doCompare(category Category, other TemplateDescri
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if other.Lang != "" && other.Lang != this.Lang {
|
if other.Lang != "" && other.Lang != this.Lang {
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
|
@ -120,7 +122,7 @@ func (this TemplateDescriptor) doCompare(category Category, other TemplateDescri
|
||||||
// We want e.g. home page in amp output format (media type text/html) to
|
// We want e.g. home page in amp output format (media type text/html) to
|
||||||
// find a template even if one isn't specified for that output format,
|
// find a template even if one isn't specified for that output format,
|
||||||
// when one exist for the html output format (same media type).
|
// when one exist for the html output format (same media type).
|
||||||
if category != CategoryBaseof && (this.Kind == "" || (this.Kind != other.Kind && this.Layout != other.Layout)) {
|
if category != CategoryBaseof && (this.Kind == "" || (this.Kind != other.Kind && (this.Layout != other.Layout && other.Layout != layoutAll))) {
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue