Skip to content

Commit

Permalink
fixed <title> values.
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed May 28, 2024
1 parent d889a9c commit f7b63f7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
12 changes: 10 additions & 2 deletions handler/app/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ func Index(c echo.Context) error {
"magazines, and other projects."
const desc = "Defacto2 is " + lead
data := empty(c)
data["title"] = "Home"
data["title"] = "Milestones"
data["description"] = desc
data["h1"] = "Welcome,"
data["milestones"] = Collection()
Expand Down Expand Up @@ -1587,7 +1587,6 @@ func Website(c echo.Context, open string) error {
for i, site := range acc {
if site.ID == open || open == "" {
site.Open = true
data["title"] = site.Title
closeAll = false
acc[i] = site
if open == "" {
Expand All @@ -1596,6 +1595,9 @@ func Website(c echo.Context, open string) error {
break
}
}
if closeAll {
data["title"] = "Website categories"
}
// If a section was requested but not found, return a 404.
if open != "hide" && closeAll {
return StatusErr(c, http.StatusNotFound, open)
Expand Down Expand Up @@ -1852,6 +1854,7 @@ func bbsHandler(c echo.Context, orderBy model.OrderBy) error {
case model.Alphabetical:
s := logo + az
data["logo"] = s
data["title"] = title + az
order = alpha
case model.Prolific:
s := logo + ", by count"
Expand All @@ -1860,6 +1863,7 @@ func bbsHandler(c echo.Context, orderBy model.OrderBy) error {
case model.Oldest:
tmpl = "bbs-year"
s := logo + byyear
data["title"] = title + byyear
data["logo"] = s
order = year
}
Expand Down Expand Up @@ -1988,13 +1992,15 @@ func magazines(c echo.Context, chronological bool) error {
}
s := title + byyear
data["logo"] = s
data["title"] = title + byyear
order = year
case false:
if err := r.MagazineAZ(ctx, db); err != nil {
return DatabaseErr(c, name, err)
}
s := title + az
data["logo"] = s
data["title"] = title + az
order = alpha
}
data[key] = r
Expand Down Expand Up @@ -2231,6 +2237,7 @@ func releasers(c echo.Context, orderBy model.OrderBy) error {
case model.Alphabetical:
s := logo + az
data["logo"] = s
data["title"] = title + az
order = alpha
case model.Prolific:
s := logo + ", by count"
Expand All @@ -2240,6 +2247,7 @@ func releasers(c echo.Context, orderBy model.OrderBy) error {
tmpl = "releaser-year"
s := logo + byyear
data["logo"] = s
data["title"] = title + byyear
order = year
}
data["stats"] = map[string]string{
Expand Down
3 changes: 2 additions & 1 deletion handler/app/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ func (web Templ) TemplateClosures() template.FuncMap { //nolint:funlen
"bootstrap5JS": func() string {
return hrefs[Bootstrap5JS]
},
"capitalize": helper.Capitalize,
"classification": func(s, p string) string {
count, _ := form.HumanizeAndCount(s, p)
return string(count)
Expand Down Expand Up @@ -474,10 +475,10 @@ func (web Templ) TemplateClosures() template.FuncMap { //nolint:funlen
return web.Subresource.Uploader
},
"tagOption": TagOption,
"toLower": strings.ToLower,
"uploader": func() string {
return hrefs[Uploader]
},
"titleize": helper.Titleize,
"version": func() string {
return web.Version
},
Expand Down
2 changes: 1 addition & 1 deletion view/app/layout.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{if ne $h1sub ""}}{{titleize $h1sub}} {{.title}}{{end}} | Defacto2</title>
<title>{{if ne $h1sub ""}}{{capitalize $h1sub}} {{toLower .title}}{{else}}{{.title}}{{end}} | Defacto2</title>
{{if ne $canonical ""}}<link rel="canonical" href="https://defacto2.net/{{$canonical}}">{{end -}}
{{if ne $desc ""}}<meta name="description" content="{{$desc}}">{{end -}}
{{if eq $desc ""}}<meta name="description" content="{{$descDefault}}">{{end}}
Expand Down

0 comments on commit f7b63f7

Please sign in to comment.