@@ 2,7 2,6 @@ Setup fishbb.org (cloud provider)
FEATURES:
rate limit registration
-proper page titles
Login/Reigster:
finish up oauth integration
@@ 2,7 2,7 @@
<table class="nav-table" id="threads">
<tr><th style="width:50%">Thread</th><th style="text-align:center;width:4rem;">Replies</th><th style="width:30%">Last Post</th></tr>
<div class="body-header">
- <a href="/thread/new?forumid={{.ForumID}}"><button class="top-button">New Thread</button></a>
+ <a href="/thread/new?forumid={{.Forum.ID}}"><button class="top-button">New Thread</button></a>
{{ template "pagelist.html" . }}
</div>
{{ if not (len .Threads) }}
@@ 13,7 13,7 @@
<td>
{{ if .Locked }} {{ template "lock.svg" }} {{ end }}
{{ if .Pinned }} {{ template "pin.svg" }} {{ end }}
- <a class="title-link" href="/f/{{$.ForumSlug}}/{{.ID}}">{{.Title}}</a><br>
+ <a class="title-link" href="/f/{{$.Forum.Slug}}/{{.ID}}">{{.Title}}</a><br>
<div class="flex-between">
<div>
by <a href="/user/{{.Author.ID}}">{{.Author.Username}}</a> <span class="text-alt" title="{{.Created}}">{{ timeago .Created }}</span>
@@ 9,8 9,15 @@
<div id="page-header">
<div>
<a href="/"><img src="/a?a={{.Config.BoardName}}" width=18px></a>
<a href="/" class="title-link">{{.Config.BoardName}}</a><br>
{{.Config.BoardDescription}}
<a href="/" class="title-link">{{.Config.BoardName}}</a>
{{ if .Forum }}
> <a class="title-link" href="/f/{{.Forum.Slug}}"</a>{{ .Forum.Name }}</a>
{{ end }}<br>
{{ if .Forum }}
{{ .Forum.Description }}
{{ else }}
{{.Config.BoardDescription}}
{{ end }}
</div>
<div id="nav">
{{ if not .User }}
@@ 31,8 31,10 @@ func serveHTML(w http.ResponseWriter, r *http.Request, name string, info map[str
info["Version"] = softwareVersion
info["CSRFToken"] = GetCSRF(r)
var title = config.BoardName
- if name != "index" {
- title += " > " + name
+ if info["Subtitle"] != nil {
+ title = info["Subtitle"].(string) + " - " + title
+ } else if name != "index" {
+ title = name + " - " + title
}
info["Title"] = title
err := views.ExecuteTemplate(w, name+".html", info)
@@ 80,25 82,29 @@ func indexPage(w http.ResponseWriter, r *http.Request) {
func forumPage(w http.ResponseWriter, r *http.Request) {
tmpl := make(map[string]any)
- fid := getForumID(r.PathValue("forum"))
+ f, err := getForumBySlug(r.PathValue("forum"))
+ if err != nil {
+ serverError(w, r, err)
+ return
+ }
page := page(r)
- threads, err := getThreads(fid, page)
+ threads, err := getThreads(f.ID, page)
if err != nil {
serverError(w, r, err)
return
}
- count, err := getThreadCount(fid)
+ count, err := getThreadCount(f.ID)
if err != nil {
serverError(w, r, err)
return
}
- tmpl["ForumID"] = fid
- tmpl["ForumSlug"] = r.PathValue("forum")
+ tmpl["Forum"] = f
tmpl["Threads"] = threads
// pagination
tmpl["Page"] = page
tmpl["ItemCount"] = count
tmpl["Threads"] = threads
+ tmpl["Subtitle"] = f.Name
serveHTML(w, r, "forum", tmpl)
}
@@ 125,6 131,7 @@ func threadPage(w http.ResponseWriter, r *http.Request) {
tmpl["ItemCount"] = thread.Replies + 1
tmpl["Forum"] = forum
tmpl["Posts"] = getPosts(threadID, page)
+ tmpl["Subtitle"] = thread.Title
serveHTML(w, r, "thread", tmpl)
}
@@ 384,6 391,7 @@ func userPage(w http.ResponseWriter, r *http.Request) {
return
}
tmpl["InfoUser"] = info
+ tmpl["Subtitle"] = info.Username
// TODO specific DNE error?
serveHTML(w, r, "user", tmpl)
}