| headshots | ||
| templates | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| main.go | ||
| README.md | ||
I'm building a website for a joke company, that provides every service ever invented. The company's website is svsindustries.org. When going to, say, webdesign.svsindustries.org, the user will be presented with a site advertising SVS Industries' web design prowess. Similarly for, say, plumbing.svsindustries.org, hvac.svsindustries.org, management-consulting.svsindustries.org, landscaping.svsindustries.org, travel-nursing.svsindustries.org, etc. All companies have the same three employees: Chandler Swift, Eric Villnow, and Isaac Swift.
The sever will be implemented in Go, and will live behind a Caddy load balancer providing TLS termination. It should pick up the requested host, and generate content based on that. It will use a template, currently templates/a.html. That template will contain slots for the variable content. The program will fill up a Page struct (detailed later) and use that to render the page.
type Color struct { // may have .rgba() and .hex() and similar functions
// something that can encode color
}
type Theme struct {
AccentColor Color
SecondaryColor Color
BackgroundColor Color
// possibly more?
}
type Testimonial struct {
Name string // Barack Obama
Position string // Frequent Design Admirer
Content string // I can't believe how good these were. After the Obamacare Website, I knew it's important to get a website right on the first try, and boy did these gentlemen manage!
}
type Page struct {
Theme Theme
Title string // "SVS Web Design"
Tagline string // "Custom websites cooked to order"
WhatWeDo string // 2-4 paragraphs following a "What We Do" header selling our incredible
ChandlerBio string // Chandler has years of experience in the [...] sector
EricBio string
IsaacBio string
}
The server will keep a cache of all previous responses, to avoid time-consuming and inconsistent results. The cache will be stored in a sqlite database, with a single table with two columns, host and content; host will be e.g. webdesign; content will be a JSON encoding of the Page struct above.
There will be a 404 page that fits the primary theme of each site (e.g. for webdesign.svsindustries.org/about-us we'll return a 404 that uses the Theme, Title, and Tagline for webdesign.svsindustries.org to generate a fairly generic 404 page.)
To start, generate main.go.