diff options
Diffstat (limited to 'routers/web/explore/repo.go')
-rw-r--r-- | routers/web/explore/repo.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/routers/web/explore/repo.go b/routers/web/explore/repo.go index e5f7977abd..0446edebe6 100644 --- a/routers/web/explore/repo.go +++ b/routers/web/explore/repo.go @@ -57,8 +57,13 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) { orderBy db.SearchOrderBy ) - ctx.Data["SortType"] = ctx.FormString("sort") - switch ctx.FormString("sort") { + sortOrder := ctx.FormString("sort") + if sortOrder == "" { + sortOrder = setting.UI.ExploreDefaultSort + } + ctx.Data["SortType"] = sortOrder + + switch sortOrder { case "newest": orderBy = db.SearchOrderByNewest case "oldest": |