Rename PageHeader.Name to AppName to avoid a field collision
A consuming project's own per-page data struct commonly embeds both PageHeader and a domain type that has its own Name field (e.g. a Kubernetes resource's name, as in yakwui's node/deployment/pod detail pages) -- two same-depth promoted "Name" fields make html/template's ".Name" an ambiguous selector that only fails at execution time, not at parse time.
This commit is contained in:
1 parent
1c1878cfca
commit
84a9faff29
4 files changed
+11
-4
No files matched your search
@@ -42,7 +42,14 @@ type NavItem struct {
|
||||
// username/logout group).
|
||||
type PageHeader struct {
|
||||
Title string
|
||||
Name string // lowercase product name, e.g. "yasta"; used in <title> and the footer
|
||||
// AppName is the lowercase product name, e.g. "yasta", used in
|
||||
// <title> and the footer. Deliberately not "Name" -- a consuming
|
||||
// project's own per-page data struct commonly embeds both PageHeader
|
||||
// and a domain type that has its own Name field (e.g. a Kubernetes
|
||||
// resource's name); two same-depth promoted "Name" fields make
|
||||
// html/template's ".Name" an ambiguous selector that only fails at
|
||||
// execution time, not at parse time.
|
||||
AppName string
|
||||
Lang string // <html lang="...">; "" defaults to "en"
|
||||
Brand string // navbar brand text, e.g. "YASTA"
|
||||
BrandInitial string // single-letter favicon glyph, e.g. "y"
|
||||
|
||||
Reference in new issue
Block a user