From 179de5f5bc0336c9c279e851ea13202b7ffe572e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 9 Jul 2018 10:29:18 +0200 Subject: Revert "Consider root and current section's content type if set in front matter" This reverts commit c790029e1dbb0b66af18d05764bd6045deb2e180. --- output/layout.go | 14 -------------- output/layout_test.go | 9 ++------- 2 files changed, 2 insertions(+), 21 deletions(-) (limited to 'output') diff --git a/output/layout.go b/output/layout.go index 2483093b0..f83490d81 100644 --- a/output/layout.go +++ b/output/layout.go @@ -35,12 +35,6 @@ type LayoutDescriptor struct { Kind string Lang string Layout string - - // Any potential type set in the page's current section and the root section - // it lives in. - TypeFirstSection string - TypeCurrentSection string - // LayoutOverride indicates what we should only look for the above layout. LayoutOverride bool } @@ -133,14 +127,6 @@ func resolvePageTemplate(d LayoutDescriptor, f Format) []string { b.addTypeVariations(d.Type) } - if d.TypeCurrentSection != "" { - b.addTypeVariations(d.TypeCurrentSection) - } - - if d.TypeFirstSection != "" { - b.addTypeVariations(d.TypeFirstSection) - } - switch d.Kind { case "page": b.addLayoutVariations("single") diff --git a/output/layout_test.go b/output/layout_test.go index 6754ddb39..4b958e9ff 100644 --- a/output/layout_test.go +++ b/output/layout_test.go @@ -90,13 +90,8 @@ func TestLayout(t *testing.T) { []string{"_default/mylayout.amp.html", "_default/single.amp.html", "_default/mylayout.html", "_default/single.html"}, 4}, {"Page with layout and type", LayoutDescriptor{Kind: "page", Layout: "mylayout", Type: "myttype"}, "", ampType, []string{"myttype/mylayout.amp.html", "myttype/single.amp.html", "myttype/mylayout.html"}, 8}, - {"Page with layout and type with subtype", LayoutDescriptor{Kind: "page", Layout: "mylayout", Type: "myttype/mysubtype", TypeCurrentSection: "cst"}, "", ampType, - []string{"myttype/mysubtype/mylayout.amp.html", "myttype/mysubtype/single.amp.html", "myttype/mysubtype/mylayout.html"}, 12}, - {"Page with type in section", LayoutDescriptor{Kind: "page", TypeCurrentSection: "cst"}, "", ampType, - []string{"cst/single.amp.html", "cst/single.html", "_default/single.amp.html", "_default/single.html"}, 4}, - {"Page with type in root section", LayoutDescriptor{Kind: "page", TypeFirstSection: "cst"}, "", ampType, - []string{"cst/single.amp.html", "cst/single.html", "_default/single.amp.html", "_default/single.html"}, 4}, - + {"Page with layout and type with subtype", LayoutDescriptor{Kind: "page", Layout: "mylayout", Type: "myttype/mysubtype"}, "", ampType, + []string{"myttype/mysubtype/mylayout.amp.html", "myttype/mysubtype/single.amp.html", "myttype/mysubtype/mylayout.html"}, 8}, // RSS {"RSS Home", LayoutDescriptor{Kind: "home"}, "", RSSFormat, []string{"index.rss.xml", "home.rss.xml", "rss.xml"}, 15}, -- cgit v1.2.3