[x/go.dev] all: introduce Page.Layout to pick layout

Hugo has complex rules for deciding which template layout applies.
https://gohugo.io/templates/lookup-order/

Replace all that complexity (hardly any of which is implemented
here anyway) with an explicit layout directive in the pages themselves.

Change-Id: Ia28061cba7886fccf014c416a531d3ab657fa6f3
X-GoDev-Commit: 4386e31ee4bb3c13dd64eed6303da11763a91f12
diff --git a/go.dev/cmd/internal/site/page.go b/go.dev/cmd/internal/site/page.go
index e8e759a..31bc61e 100644
--- a/go.dev/cmd/internal/site/page.go
+++ b/go.dev/cmd/internal/site/page.go
@@ -36,6 +36,7 @@
 	Date         anyTime
 	Description  string `yaml:"description"`
 	IsHome       bool
+	Layout       string `yaml:"layout"`
 	LinkTitle    string `yaml:"linkTitle"`
 	Pages        []*Page
 	Params       map[string]interface{}
@@ -157,7 +158,10 @@
 	// Load page-specific layout template.
 	// There are general rules in Hugo, but we don't need to reproduce them here
 	// since this will go away.
-	layout := "layouts/_default/single.html"
+	layout := "layouts/default.tmpl"
+	if p.Layout != "" {
+		layout = "layouts/" + p.Layout + ".tmpl"
+	}
 	switch p.id {
 	case "":
 		layout = "layouts/index.html"
@@ -166,9 +170,6 @@
 	case "solutions":
 		layout = "layouts/solutions/section.html"
 	}
-	if strings.HasPrefix(p.id, "solutions/") {
-		layout = "layouts/solutions/single.html"
-	}
 	data, err := ioutil.ReadFile(p.Site.file(layout))
 	if err != nil {
 		return err
diff --git a/go.dev/content/about.md b/go.dev/content/about.md
index 9030012..15c9fbc 100644
--- a/go.dev/content/about.md
+++ b/go.dev/content/about.md
@@ -1,7 +1,7 @@
 ---
 title: 'About'
+layout: article
 date: 2019-06-25T17:51:23-04:00
-draft: false
 ---
 
 [Go.dev](https://go.dev) is a companion website to [golang.org](https://golang.org). [Golang.org](https://golang.org) is the home of the open source project and distribution, while [go.dev](https://go.dev) is the hub for Go users providing centralized and curated resources from across the Go ecosystem.
diff --git a/go.dev/content/copyright.md b/go.dev/content/copyright.md
index 6488c43..dd1befe 100644
--- a/go.dev/content/copyright.md
+++ b/go.dev/content/copyright.md
@@ -1,5 +1,6 @@
 ---
 title: "Copyright"
+layout: article
 date: 2019-11-05T15:50:08-05:00
 ---
 
diff --git a/go.dev/content/solutions/americanexpress/index.md b/go.dev/content/solutions/americanexpress/index.md
index b2e44c2..b114150 100644
--- a/go.dev/content/solutions/americanexpress/index.md
+++ b/go.dev/content/solutions/americanexpress/index.md
@@ -1,5 +1,6 @@
 ---
 title: "American Express Uses Go for Payments & Rewards"
+layout: solution
 company: American Express
 logoSrc: american-express.svg
 heroImgSrc: go_amex_case_study_logo.png
diff --git a/go.dev/content/solutions/armut/index.md b/go.dev/content/solutions/armut/index.md
index b60ac5c..08d3a58 100644
--- a/go.dev/content/solutions/armut/index.md
+++ b/go.dev/content/solutions/armut/index.md
@@ -1,6 +1,7 @@
 ---
 linkTitle: "How Armut Labs use Go "
 description: "Learn about how Armut Labs reduced resource consumption and API response time after moving from C# and .net core to Go."
+layout: solution
 company: Armut
 logoSrc: armut.png
 series: Case Studies
diff --git a/go.dev/content/solutions/capital-one/index.md b/go.dev/content/solutions/capital-one/index.md
index d86b32e..2f0e7af 100644
--- a/go.dev/content/solutions/capital-one/index.md
+++ b/go.dev/content/solutions/capital-one/index.md
@@ -1,6 +1,7 @@
 ---
 linkTitle: "Capital One - A Serverless and Go Journey"
 description: "At the time, no single team member knew Go, but within a month, everyone was writing in Go and we were building out the endpoints. It was the flexibility, how easy it was to use, and the really cool concept behind Go (how Go handles native concurrency, garbage collection, and of course safety+speed.) that helped engage us during the build. Also, who can beat that cute mascot!"
+layout: solution
 company: Capital One
 logoSrc: capital-one.svg
 series: Case Studies
diff --git a/go.dev/content/solutions/clis/index.md b/go.dev/content/solutions/clis/index.md
index fcd6c42..d1dba8a 100644
--- a/go.dev/content/solutions/clis/index.md
+++ b/go.dev/content/solutions/clis/index.md
@@ -3,6 +3,7 @@
 linkTitle: "Command-line Interfaces (CLIs)"
 description: "With popular open source packages and a robust standard library, use Go to create fast and elegant CLIs."
 date: 2019-10-04T15:26:31-04:00
+layout: solution
 series: Use Cases
 resources:
 - name: icon
diff --git a/go.dev/content/solutions/cloud/index.md b/go.dev/content/solutions/cloud/index.md
index 46c8867..67c821a 100644
--- a/go.dev/content/solutions/cloud/index.md
+++ b/go.dev/content/solutions/cloud/index.md
@@ -3,6 +3,7 @@
 linkTitle: "Cloud & Network Services"
 description: "With a strong ecosystem of tools and APIs on major cloud providers, it is easier than ever to build services with Go."
 date: 2019-10-04T15:26:31-04:00
+layout: solution
 series: Use Cases
 resources:
   - name: icon
diff --git a/go.dev/content/solutions/cloudflare/index.md b/go.dev/content/solutions/cloudflare/index.md
index e086501..a754ca1 100644
--- a/go.dev/content/solutions/cloudflare/index.md
+++ b/go.dev/content/solutions/cloudflare/index.md
@@ -4,6 +4,7 @@
   and other properties connected to the Internet. “Go is at the heart of CloudFlare’s
   services including handling compression for high-latency HTTP connections, our
   entire DNS infrastructure, SSL, load testing and more.”
+layout: solution
 company: Cloudflare
 series: Case Studies
 logoSrc: cloudflare.svg
diff --git a/go.dev/content/solutions/cockroachlabs/index.md b/go.dev/content/solutions/cockroachlabs/index.md
index 7f3f4f0..884e4a9 100644
--- a/go.dev/content/solutions/cockroachlabs/index.md
+++ b/go.dev/content/solutions/cockroachlabs/index.md
@@ -2,6 +2,7 @@
 linkTitle: Cockroach Labs - Why We Chose to Build Our Database with Go
 description: Go's performance benefits, garbage collection, and low barrier to entry
   made it a great fit for CockroachDB.
+layout: solution
 company: Cockroach Labs
 logoSrc: cockroach.svg
 series: Case Studies
diff --git a/go.dev/content/solutions/curve/index.md b/go.dev/content/solutions/curve/index.md
index aedf5db..d52ca14 100644
--- a/go.dev/content/solutions/curve/index.md
+++ b/go.dev/content/solutions/curve/index.md
@@ -2,6 +2,7 @@
 linkTitle: How Curve is getting ahead with Golang
 description: Curve shares how Go's efficiency, standard library, and thriving community
   help them move banking to the cloud.
+layout: solution
 company: Curve
 logoSrc: curve.png
 series: Case Studies
diff --git a/go.dev/content/solutions/devops/index.md b/go.dev/content/solutions/devops/index.md
index e5d60b5..42cc2d9 100644
--- a/go.dev/content/solutions/devops/index.md
+++ b/go.dev/content/solutions/devops/index.md
@@ -3,6 +3,7 @@
 linkTitle: "Development Operations & Site reliability Engineering"
 description: "With fast build times, lean syntax, an automatic formatter and doc generator, Go is built to support both DevOps and SRE."
 date: 2019-10-03T17:16:43-04:00
+layout: solution
 series: Use Cases
 books:
 resources:
diff --git a/go.dev/content/solutions/dropbox/index.md b/go.dev/content/solutions/dropbox/index.md
index a57c3e7..1503ff2 100644
--- a/go.dev/content/solutions/dropbox/index.md
+++ b/go.dev/content/solutions/dropbox/index.md
@@ -1,6 +1,7 @@
 ---
 title: "Dropbox - Open sourcing our Go libraries"
 description: "About a year ago, we decided to migrate our performance-critical backends from Python to Go to leverage better concurrency support and faster execution speed. ... At this point, we have successfully moved major parts of our infrastructure to Go."
+layout: solution
 company: Dropbox
 logoSrc: dropbox.png
 series: Case Studies
diff --git a/go.dev/content/solutions/facebook/index.md b/go.dev/content/solutions/facebook/index.md
index 79eab13..59eb318 100644
--- a/go.dev/content/solutions/facebook/index.md
+++ b/go.dev/content/solutions/facebook/index.md
@@ -3,6 +3,7 @@
 description: 
   Learn about a Facebook engineering team's decision to write a new entity
   framework (ORM) in Go.
+layout: solution
 company: Facebook
 series: Case Studies
 logoSrc: facebook.png
diff --git a/go.dev/content/solutions/google/_index.md b/go.dev/content/solutions/google/_index.md
index 654750e..33d3e4e 100644
--- a/go.dev/content/solutions/google/_index.md
+++ b/go.dev/content/solutions/google/_index.md
@@ -1,13 +1,13 @@
 ---
 title: 'Using Go at Google'
 date: 2020-08-27
+layout: solution
 company: Google
 logoSrc: google.svg
 heroImgSrc: go_core_data_case_study.png
 carouselImgSrc: go_google_case_study_carousel.png
 series: Case Studies
 type: solutions
-layout: single
 description: |-
   Google is a technology company whose mission is to organize the world’s
   information and make it universally accessible and useful.
diff --git a/go.dev/content/solutions/google/chrome.md b/go.dev/content/solutions/google/chrome.md
index 8a63437..b0ee9d0 100644
--- a/go.dev/content/solutions/google/chrome.md
+++ b/go.dev/content/solutions/google/chrome.md
@@ -1,5 +1,6 @@
 ---
 title: "Chrome Content Optimization Service Runs on Go"
+layout: solution
 company: Chrome
 logoSrc: chrome.svg
 heroImgSrc: go_chrome_case_study.png
diff --git a/go.dev/content/solutions/google/coredata.md b/go.dev/content/solutions/google/coredata.md
index 8182f2f..e9bbb0a 100644
--- a/go.dev/content/solutions/google/coredata.md
+++ b/go.dev/content/solutions/google/coredata.md
@@ -1,5 +1,6 @@
 ---
 title: "How Google's Core Data Solutions Team Uses Go"
+layout: solution
 company: Core Data
 logoSrc: google.svg
 heroImgSrc: go_core_data_case_study.png
diff --git a/go.dev/content/solutions/google/firebase.md b/go.dev/content/solutions/google/firebase.md
index fd7e543..f46fba9 100644
--- a/go.dev/content/solutions/google/firebase.md
+++ b/go.dev/content/solutions/google/firebase.md
@@ -1,5 +1,6 @@
 ---
 title: "How the Firebase Hosting Team Scaled With Go"
+layout: solution
 company: Firebase
 logoSrc: firebase.svg
 heroImgSrc: go_firebase_case_study.png
diff --git a/go.dev/content/solutions/google/sitereliability.md b/go.dev/content/solutions/google/sitereliability.md
index 7b03abc..251a4b1 100644
--- a/go.dev/content/solutions/google/sitereliability.md
+++ b/go.dev/content/solutions/google/sitereliability.md
@@ -1,5 +1,6 @@
 ---
 title: "Actuating Google Production: How Google’s Site Reliability Engineering Team Uses Go"
+layout: solution
 company: Google Site Reliability Engineering (SRE)
 logoSrc: sitereliability.svg
 heroImgSrc: go_sitereliability_case_study.png
diff --git a/go.dev/content/solutions/grail/index.md b/go.dev/content/solutions/grail/index.md
index a0df8dc..b6be2ea 100644
--- a/go.dev/content/solutions/grail/index.md
+++ b/go.dev/content/solutions/grail/index.md
@@ -5,6 +5,7 @@
   newcomers to learn; its transparent runtime semantics makes it easy to reason
   about performance; and its ability to control data layout and allocation makes
   it possible to write highly performant data processing code.
+layout: solution
 company: GRAIL
 logoSrc: grail.png
 series: Case Studies
diff --git a/go.dev/content/solutions/mercadolibre/index.md b/go.dev/content/solutions/mercadolibre/index.md
index 9a68dc1..f104448 100644
--- a/go.dev/content/solutions/mercadolibre/index.md
+++ b/go.dev/content/solutions/mercadolibre/index.md
@@ -1,5 +1,6 @@
 ---
 title: "MercadoLibre Grows with Go"
+layout: solution
 company: MercadoLibre
 logoSrc: mercado-libre.png
 heroImgSrc: go_mercadolibre_case_study_logo.png
diff --git a/go.dev/content/solutions/microsoft/index.md b/go.dev/content/solutions/microsoft/index.md
index d0c1ea4..ddcd77e 100644
--- a/go.dev/content/solutions/microsoft/index.md
+++ b/go.dev/content/solutions/microsoft/index.md
@@ -3,6 +3,7 @@
 description: 
   Learn about how Microsoft has helped support Go and how it uses Go to power
   pieces of it's cloud infrastructure.
+layout: solution
 company: Microsoft
 series: Case Studies
 logoSrc: microsoft.png
diff --git a/go.dev/content/solutions/netflix/index.md b/go.dev/content/solutions/netflix/index.md
index ff0ddcd..1a72407 100644
--- a/go.dev/content/solutions/netflix/index.md
+++ b/go.dev/content/solutions/netflix/index.md
@@ -1,6 +1,7 @@
 ---
 linkTitle: "Netflix - Application data caching using SSDs"
 description: "The decision to use Go was deliberate, because we needed something that had lower latency than Java (where garbage collection pauses are an issue) and is more productive for developers than C, while also handling tens of thousands of client connections. Go fits this space well."
+layout: solution
 company: Netflix
 logoSrc: netflix.svg
 series: Case Studies
diff --git a/go.dev/content/solutions/paypal/index.md b/go.dev/content/solutions/paypal/index.md
index 7cdf962..9680331 100644
--- a/go.dev/content/solutions/paypal/index.md
+++ b/go.dev/content/solutions/paypal/index.md
@@ -1,6 +1,7 @@
 ---
 title: PayPal Taps Go to Modernize and Scale
 date: 2020-06-01
+layout: solution
 company: PayPal
 logoSrc: paypal.svg
 heroImgSrc: go_paypal_case_study_logo.png
diff --git a/go.dev/content/solutions/riotgames/index.md b/go.dev/content/solutions/riotgames/index.md
index a9e151e..c595fd2 100644
--- a/go.dev/content/solutions/riotgames/index.md
+++ b/go.dev/content/solutions/riotgames/index.md
@@ -1,6 +1,7 @@
 ---
 linkTitle: "Riot Games - Leveraging Golang for Game Development and Operations"
 description: "Learn how Riot uses Go to develop, deploy, and operate backend microserves at scale–globally. They share thier experience across use cases, with specific examples, and speak to the value of the gopher community."
+layout: solution
 company: Riot Games
 logoSrc: riotgames.png
 series: Case Studies
diff --git a/go.dev/content/solutions/salesforce/index.md b/go.dev/content/solutions/salesforce/index.md
index 21b3f56..5dbfe05 100644
--- a/go.dev/content/solutions/salesforce/index.md
+++ b/go.dev/content/solutions/salesforce/index.md
@@ -1,6 +1,7 @@
 ---
 linkTitle: "Salesforce - From Python/C to Go"
 description: "One of the big advantages is that Go's cross-platform features make porting code easy."
+layout: solution
 company: Salesforce
 logoSrc: salesforce.svg
 series: Case Studies
diff --git a/go.dev/content/solutions/target/index.md b/go.dev/content/solutions/target/index.md
index 3dc004f..3b7d54d 100644
--- a/go.dev/content/solutions/target/index.md
+++ b/go.dev/content/solutions/target/index.md
@@ -1,5 +1,6 @@
 ---
 linkTitle: "Target - Recommending Go"
+layout: solution
 company: Target
 logoSrc: target.svg
 series: Case Studies
diff --git a/go.dev/content/solutions/twitch/index.md b/go.dev/content/solutions/twitch/index.md
index f21b80c..40b34db 100644
--- a/go.dev/content/solutions/twitch/index.md
+++ b/go.dev/content/solutions/twitch/index.md
@@ -1,6 +1,7 @@
 ---
 linkTitle: "Twitch - Go’s march to low latency GC"
 description: "We use Go at Twitch for many of our busiest systems. Its simplicity, safety, performance, and readability make it a good tool for the problems we encounter with serving live video and chat to our  millions of users."
+layout: solution
 company: Twitch
 logoSrc: twitch.svg
 series: Case Studies
diff --git a/go.dev/content/solutions/twitter/index.md b/go.dev/content/solutions/twitter/index.md
index 2dbdebd..6e0cd1e 100644
--- a/go.dev/content/solutions/twitter/index.md
+++ b/go.dev/content/solutions/twitter/index.md
@@ -1,6 +1,7 @@
 ---
 title: "Twitter - 5 billion sessions a day in realtime"
 description: "We now see about five billion sessions per day, and growing. Hundreds of millions of devices send millions of events every second to the Answers endpoint. During the time that it took you to read to here, the Answers back-end will have received and processed about 10,000,000 analytics events."
+layout: solution
 company: Twitter
 logoSrc: twitter.svg
 series: Case Studies
diff --git a/go.dev/content/solutions/uber/index.md b/go.dev/content/solutions/uber/index.md
index 839cb6b..50485fd 100644
--- a/go.dev/content/solutions/uber/index.md
+++ b/go.dev/content/solutions/uber/index.md
@@ -1,6 +1,7 @@
 ---
 title: "Uber - GPU-power analytics engine in Go"
 description: "AresDB [,written in Go,] is widely used at Uber to power our real-time data analytics dashboards, enabling us to make data-driven decisions at scale about myriad aspects of our business."
+layout: solution
 company: Uber
 logoSrc: uber.svg
 series: Case Studies
diff --git a/go.dev/content/solutions/webdev/index.md b/go.dev/content/solutions/webdev/index.md
index 695c262..b9ca83d 100644
--- a/go.dev/content/solutions/webdev/index.md
+++ b/go.dev/content/solutions/webdev/index.md
@@ -3,6 +3,7 @@
 linkTitle: "Web Development"
 description: "With enhanced memory performance and support for several IDEs, Go powers fast and scalable web applications."
 date: 2019-10-04T15:26:31-04:00
+layout: solution
 series: Use Cases
 books:
 resources:
diff --git a/go.dev/content/solutions/wildlifestudios/index.md b/go.dev/content/solutions/wildlifestudios/index.md
index db0b946..2f6b617 100644
--- a/go.dev/content/solutions/wildlifestudios/index.md
+++ b/go.dev/content/solutions/wildlifestudios/index.md
@@ -6,6 +6,7 @@
   language for our core platform, given its features to scale our backend
   services.
 logoSrc: wildlife.svg
+layout: solution
 company: Wildlife Studios
 series: Case Studies
 link:
diff --git a/go.dev/content/tos.md b/go.dev/content/tos.md
index 6aff32d..7054d11 100644
--- a/go.dev/content/tos.md
+++ b/go.dev/content/tos.md
@@ -1,5 +1,6 @@
 ---
 title: "Terms of Service"
+layout: article
 date: 2019-11-05T15:47:16-05:00
 ---
 
diff --git a/go.dev/layouts/_default/baseof.html b/go.dev/layouts/_default/baseof.html
index a2ff3a5..2630894 100644
--- a/go.dev/layouts/_default/baseof.html
+++ b/go.dev/layouts/_default/baseof.html
@@ -121,7 +121,7 @@
 </aside>
 <div class="NavigationDrawer-scrim js-scrim" role="presentation"></div>
 <main class="SiteContent{{if $.Site.Data.messaging.messaging.HeaderMessagingBar }} SiteContent--lower{{else}} SiteContent--default{{end}}">
-  {{- block "main" . -}}{{- end -}}
+  {{- block "layout" . -}}{{- end -}}
 </main>
 <footer class="Site-footer">
   <div class="Footer">
diff --git a/go.dev/layouts/_default/single.html b/go.dev/layouts/article.tmpl
similarity index 86%
rename from go.dev/layouts/_default/single.html
rename to go.dev/layouts/article.tmpl
index 3908707..1fa6431 100644
--- a/go.dev/layouts/_default/single.html
+++ b/go.dev/layouts/article.tmpl
@@ -1,4 +1,4 @@
-{{define "main"}}
+{{define "layout"}}
   <article class="Article {{if .Section -}}Article--{{.Section}}{{end -}}">
     <h1>{{.Title}}</h1>
     {{.Content}}
diff --git a/go.dev/layouts/index.html b/go.dev/layouts/index.html
index 3c97a49..d6be0c9 100644
--- a/go.dev/layouts/index.html
+++ b/go.dev/layouts/index.html
@@ -1,4 +1,4 @@
-{{define "main"}}
+{{define "layout"}}
 <section class="Hero bluebg">
   <div class="Hero-gridContainer">
     <div class="Hero-blurb">
diff --git a/go.dev/layouts/learn/section.html b/go.dev/layouts/learn/section.html
index 485c4ca..c78a410 100644
--- a/go.dev/layouts/learn/section.html
+++ b/go.dev/layouts/learn/section.html
@@ -1,4 +1,4 @@
-{{define "main"}}
+{{define "layout"}}
 <section class="Learn-hero">
   <div class="Container">
     <div class="Learn-heroInner">
diff --git a/go.dev/layouts/solutions/single.html b/go.dev/layouts/solution.tmpl
similarity index 98%
rename from go.dev/layouts/solutions/single.html
rename to go.dev/layouts/solution.tmpl
index 2d8655c..8f21900 100644
--- a/go.dev/layouts/solutions/single.html
+++ b/go.dev/layouts/solution.tmpl
@@ -1,4 +1,4 @@
-{{define "main"}}
+{{define "layout"}}
 <div>
   <div class="WhoUsesSubPage-hero{{if (eq .Params.Series "Case Studies")}}--caseStudy{{else}}--useCase{{end}}">
     <div class="WhoUsesSubPage-heroInner{{if (eq .Params.Series "Case Studies")}}--caseStudy{{else}}--useCase{{end}}">
diff --git a/go.dev/layouts/solutions/section.html b/go.dev/layouts/solutions/section.html
index 20d64dc..b41afff 100644
--- a/go.dev/layouts/solutions/section.html
+++ b/go.dev/layouts/solutions/section.html
@@ -1,4 +1,4 @@
-{{define "main"}}
+{{define "layout"}}
 <section class="Solutions-headline">
   <div class="GoCarousel" id="SolutionsHeroCarousel-carousel">
     <div class="GoCarousel-controlsContainer">