diff --git a/src/templates/src/fishbowl.html b/src/templates/src/fishbowl.html index ed7707e..8c5149a 100644 --- a/src/templates/src/fishbowl.html +++ b/src/templates/src/fishbowl.html @@ -70,7 +70,8 @@ {{ define "content" }}
-

{{ .Info.Title }}

+

{{ .Info.Title }}

+

{{ .Info.Description }}

diff --git a/src/templates/src/fishbowl_index.html b/src/templates/src/fishbowl_index.html index 943a38e..6035cc0 100644 --- a/src/templates/src/fishbowl_index.html +++ b/src/templates/src/fishbowl_index.html @@ -1,7 +1,33 @@ {{ template "base.html" . }} {{ define "content" }} - +
+

Fishbowls

+ +

Every two months on the Discord, we host a fishbowl: a panel conversation where a select few community members can discuss a topic in detail. Fishbowls give us the opportunity to discuss difficult subjects with more nuance and detail than you can find anywhere else on the Internet. In many ways, they're a distillation of everything the network is about.

+ +

This is an archive of those conversations. If you would like to catch one live, join the Discord!

+ +

We're still working through our backlog of fishbowls, so not all of these are available yet. We'll publish them as we finish them.

+ +
+ {{ range .Fishbowls }} +
+ {{ if .Valid }} +

{{ .Fishbowl.Title }}

+ {{ else }} +

{{ .Fishbowl.Title }}

+ {{ end }} +
+ {{ .Fishbowl.Month }} {{ .Fishbowl.Year }} +
+ {{ with .Fishbowl.Description }} +
{{ . }}
+ {{ end }} +
+ {{ end }} +
+ +

If you'd like to help us plan more fishbowls, join the discussion over on GitHub.

+
{{ end }} diff --git a/src/website/fishbowl.go b/src/website/fishbowl.go index 08bdc24..52c61b9 100644 --- a/src/website/fishbowl.go +++ b/src/website/fishbowl.go @@ -1,11 +1,11 @@ package website import ( - "fmt" "html/template" "io" "io/fs" "net/http" + "sort" "strings" "time" @@ -22,11 +22,11 @@ var fishbowlFS = utils.Must1(fs.Sub(templates.FishbowlFS, "src/fishbowls")) var fishbowlHTTPFS = http.StripPrefix("/fishbowl", http.FileServer(http.FS(fishbowlFS))) type fishbowlInfo struct { - Slug string - Title string - Month time.Month - Year int - ContentsPath string + Slug string + Title, Description string // The description is used for OpenGraph, so it must be plain text, no HTML. + Month time.Month + Year int + ContentsPath string } var fishbowls = [...]fishbowlInfo{ @@ -66,41 +66,62 @@ var fishbowls = [...]fishbowlInfo{ Month: time.May, Year: 2021, }, { - Slug: "teaching-software", - Title: "How software development is taught", - Month: time.June, Year: 2021, + Slug: "teaching-software", + Title: "How software development is taught", + Description: "The Handmade Network exists because we are unhappy with the software status quo. To a large extent, this is because of how software development is taught. What are the good parts of software education today, what are the flaws, and how might we change things to improve the state of software?", + Month: time.June, Year: 2021, }, { - Slug: "flexible-software", - Title: "How to design flexible software", - Month: time.December, Year: 2021, + Slug: "flexible-software", + Title: "How to design flexible software", + Description: "We previously held a fishbowl about how to design to avoid configuration. But when you can't avoid configuration, how do you do it well? And if we want our software to be flexible, what other options do we have besides configuration? What other ways are there to make software flexible?", + Month: time.December, Year: 2021, }, { - Slug: "oop", - Title: "What, if anything, is OOP?", - Month: time.May, Year: 2022, + Slug: "oop", + Title: "What, if anything, is OOP?", + Description: "Is object-oriented programming bad? Is it good? What even is it, anyway? This fishbowl explores OOP more carefully—what is the essence of it, what are the good parts, why did it take over the world, and why do we criticize it so much?", + Month: time.May, Year: 2022, ContentsPath: "oop/OOP.html", }, } func FishbowlIndex(c *RequestContext) ResponseData { type fishbowlTmpl struct { - Date string - Title string - Url string + Fishbowl fishbowlInfo + Url string + Valid bool + + date time.Time + } + type tmpl struct { + templates.BaseData + Fishbowls []fishbowlTmpl + } + + tmplData := tmpl{ + BaseData: getBaseData(c, "Fishbowls", []templates.Breadcrumb{ + {Name: "Fishbowls", Url: hmnurl.BuildFishbowlIndex()}, + }), } var fishbowlTmpls []fishbowlTmpl for _, f := range fishbowls { fishbowlTmpls = append(fishbowlTmpls, fishbowlTmpl{ - Date: fmt.Sprintf("%s %d", f.Month.String(), f.Year), - Title: f.Title, - Url: hmnurl.BuildFishbowl(f.Slug), + Fishbowl: f, + Url: hmnurl.BuildFishbowl(f.Slug), + Valid: f.ContentsPath != "", + + date: time.Date(f.Year, f.Month, 0, 0, 0, 0, 0, time.UTC), }) } + sort.Slice(fishbowlTmpls, func(i, j int) bool { + return fishbowlTmpls[j].date.Before(fishbowlTmpls[i].date) // reverse + }) + tmplData.Fishbowls = fishbowlTmpls var res ResponseData - err := res.WriteTemplate("fishbowl_index.html", getBaseData(c, "Fishbowls", nil), c.Perf) + err := res.WriteTemplate("fishbowl_index.html", tmplData, c.Perf) if err != nil { return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to render fishbowl index page")) } @@ -146,6 +167,10 @@ func Fishbowl(c *RequestContext) ResponseData { Info: info, Contents: template.HTML(utils.Must1(io.ReadAll(contentsFile))), } + tmpl.BaseData.OpenGraphItems = append(tmpl.BaseData.OpenGraphItems, templates.OpenGraphItem{ + Property: "og:description", + Value: info.Description, + }) var res ResponseData err := res.WriteTemplate("fishbowl.html", tmpl, c.Perf)