mirror of https://github.com/jlelse/GoBlog
Fix pagination, use blog title and descriptions in feed as fallback
This commit is contained in:
parent
8ef592cb22
commit
4393d28186
6
feeds.go
6
feeds.go
|
@ -18,6 +18,12 @@ const (
|
|||
|
||||
func generateFeed(f feedType, w http.ResponseWriter, r *http.Request, posts []*Post, title string, description string) {
|
||||
now := time.Now()
|
||||
if title == "" {
|
||||
title = appConfig.Blog.Title
|
||||
}
|
||||
if description == "" {
|
||||
description = appConfig.Blog.Description
|
||||
}
|
||||
feed := &feeds.Feed{
|
||||
Title: title,
|
||||
Description: description,
|
||||
|
|
10
http.go
10
http.go
|
@ -137,11 +137,11 @@ func buildHandler() (http.Handler, error) {
|
|||
rootPath := "/"
|
||||
blogPath := "/blog"
|
||||
if routePatterns := routesToStringSlice(r.Routes()); !routePatterns.has(rootPath) {
|
||||
r.With(cacheMiddleware, minifier.Middleware).Get(rootPath, serveHome(rootPath, NONE))
|
||||
r.With(cacheMiddleware, minifier.Middleware).Get(rootPath+rssPath, serveHome(rootPath, RSS))
|
||||
r.With(cacheMiddleware, minifier.Middleware).Get(rootPath+jsonPath, serveHome(rootPath, JSON))
|
||||
r.With(cacheMiddleware, minifier.Middleware).Get(rootPath+atomPath, serveHome(rootPath, ATOM))
|
||||
r.With(cacheMiddleware, minifier.Middleware).Get(paginationPath, serveHome(rootPath, NONE))
|
||||
r.With(cacheMiddleware, minifier.Middleware).Get(rootPath, serveHome("", NONE))
|
||||
r.With(cacheMiddleware, minifier.Middleware).Get(rootPath+rssPath, serveHome("", RSS))
|
||||
r.With(cacheMiddleware, minifier.Middleware).Get(rootPath+jsonPath, serveHome("", JSON))
|
||||
r.With(cacheMiddleware, minifier.Middleware).Get(rootPath+atomPath, serveHome("", ATOM))
|
||||
r.With(cacheMiddleware, minifier.Middleware).Get(paginationPath, serveHome("", NONE))
|
||||
} else if !routePatterns.has(blogPath) {
|
||||
r.With(cacheMiddleware, minifier.Middleware).Get(blogPath, serveHome(blogPath, NONE))
|
||||
r.With(cacheMiddleware, minifier.Middleware).Get(blogPath+rssPath, serveHome(blogPath, RSS))
|
||||
|
|
4
posts.go
4
posts.go
|
@ -129,10 +129,6 @@ func serveIndex(path string, sec *section, tax *taxonomy, taxonomyValue string,
|
|||
} else if sec != nil {
|
||||
title = sec.Title
|
||||
description = sec.Description
|
||||
} else if tax == nil && sec == nil {
|
||||
// Show no title or description on home
|
||||
// title = appConfig.Blog.Title
|
||||
// description = appConfig.Blog.Description
|
||||
}
|
||||
// Check if feed
|
||||
if ft != NONE {
|
||||
|
|
Loading…
Reference in New Issue