diff --git a/internal/pkg/cache/comments.go b/internal/pkg/cache/comments.go index 4c4b922..a1572fe 100644 --- a/internal/pkg/cache/comments.go +++ b/internal/pkg/cache/comments.go @@ -3,16 +3,14 @@ package cache import ( "context" "github.com/fthvgb1/wp-go/cache" + "github.com/fthvgb1/wp-go/helper/number" "github.com/fthvgb1/wp-go/internal/pkg/logs" "github.com/fthvgb1/wp-go/internal/pkg/models" "time" ) func RecentComments(ctx context.Context, n int) (r []models.Comments) { - nn := n - if nn <= 5 { - nn = 10 - } + nn := number.Max(n, 10) r, err := recentCommentsCaches.GetCache(ctx, time.Second, ctx, nn) if len(r) > n { r = r[0:n] diff --git a/internal/theme/twentyfifteen/layout/sidebar.gohtml b/internal/theme/twentyfifteen/layout/sidebar.gohtml index 367b315..67b5a6c 100644 --- a/internal/theme/twentyfifteen/layout/sidebar.gohtml +++ b/internal/theme/twentyfifteen/layout/sidebar.gohtml @@ -1,6 +1,9 @@ {{define "layout/sidebar" }}