mirror of https://github.com/jlelse/GoBlog
Small improvements
This commit is contained in:
parent
a47a1719eb
commit
4bba5c9a4a
4
cache.go
4
cache.go
|
@ -95,9 +95,9 @@ func cacheKey(r *http.Request) string {
|
|||
func cacheURLString(u *url.URL) string {
|
||||
var buf strings.Builder
|
||||
_, _ = buf.WriteString(u.EscapedPath())
|
||||
if u.RawQuery != "" {
|
||||
if q := u.Query(); len(q) > 0 {
|
||||
_ = buf.WriteByte('?')
|
||||
_, _ = buf.WriteString(u.RawQuery)
|
||||
_, _ = buf.WriteString(q.Encode())
|
||||
}
|
||||
return buf.String()
|
||||
}
|
||||
|
|
3
posts.go
3
posts.go
|
@ -10,6 +10,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/microcosm-cc/bluemonday"
|
||||
"github.com/vcraescu/go-paginator"
|
||||
)
|
||||
|
||||
|
@ -233,6 +234,8 @@ func serveIndex(ic *indexConfig) func(w http.ResponseWriter, r *http.Request) {
|
|||
} else if search != "" {
|
||||
title = fmt.Sprintf("%s: %s", appConfig.Blogs[ic.blog].Search.Title, search)
|
||||
}
|
||||
// Clean title
|
||||
title = bluemonday.StrictPolicy().Sanitize(title)
|
||||
// Check if feed
|
||||
if ft := feedType(chi.URLParam(r, "feed")); ft != noFeed {
|
||||
generateFeed(ic.blog, ft, w, r, posts, title, description)
|
||||
|
|
|
@ -13,9 +13,13 @@
|
|||
<hr>
|
||||
{{ end }}
|
||||
{{ $blog := .Blog }}
|
||||
{{ $summaryTemplate := .Data.SummaryTemplate }}
|
||||
{{ range $i, $post := .Data.Posts }}
|
||||
{{ include $summaryTemplate $blog $post }}
|
||||
{{ if .Data.Posts }}
|
||||
{{ $summaryTemplate := .Data.SummaryTemplate }}
|
||||
{{ range $i, $post := .Data.Posts }}
|
||||
{{ include $summaryTemplate $blog $post }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<p>{{ string .Blog.Lang "noposts" }}</p>
|
||||
{{ end }}
|
||||
{{ if .Data.HasPrev }}
|
||||
<p><a href="{{ .Data.Prev }}">{{ string .Blog.Lang "prev" }}</a></p>
|
||||
|
|
|
@ -11,6 +11,7 @@ interactions: "Interaktionen & Kommentare"
|
|||
interactionslabel: "Hast du eine Antwort hierzu veröffentlicht? Füge hier die URL ein."
|
||||
likeof: "Gefällt mir von"
|
||||
next: "Weiter"
|
||||
noposts: "Hier sind keine Posts."
|
||||
oldcontent: "⚠️ Dieser Eintrag ist bereits über ein Jahr alt. Er ist möglicherweise nicht mehr aktuell. Meinungen können sich geändert haben."
|
||||
prev: "Zurück"
|
||||
publishedon: "Veröffentlicht am"
|
||||
|
|
|
@ -20,6 +20,7 @@ login: "Login"
|
|||
logout: "Logout"
|
||||
nameopt: "Name (optional)"
|
||||
next: "Next"
|
||||
noposts: "There are no posts here."
|
||||
notifications: "Notifications"
|
||||
oldcontent: "⚠️ This entry is already over one year old. It may no longer be up to date. Opinions may have changed."
|
||||
password: "Password"
|
||||
|
|
Loading…
Reference in New Issue