diff --git a/api/trending.go b/api/trending.go index b69a345..9339981 100644 --- a/api/trending.go +++ b/api/trending.go @@ -36,6 +36,8 @@ func (client *Client) FetchTrending(section, sort, page string) ([]Submission, e case "best": q.Add("filter[window]", "all") q.Add("sort", "-top") + case "random": + q.Add("sort", "random") case "popular": fallthrough default: @@ -51,6 +53,8 @@ func (client *Client) FetchTrending(section, sort, page string) ([]Submission, e case "top": q.Add("filter[section]", "eq:top") q.Add("filter[window]", "day") + case "random": + q.Add("filter[section]", "eq:random") default: q.Add("filter[section]", "eq:hot") section = "hot" diff --git a/pages/trending.go b/pages/trending.go index c44a6d0..b513ca1 100644 --- a/pages/trending.go +++ b/pages/trending.go @@ -25,7 +25,7 @@ func HandleTrending(c *fiber.Ctx) error { section := c.Query("section") switch section { - case "hot", "new", "top": + case "hot", "new", "top", "random": default: section = "hot" } diff --git a/views/trending.hbs b/views/trending.hbs index eaaf732..3f786cf 100644 --- a/views/trending.hbs +++ b/views/trending.hbs @@ -30,20 +30,35 @@ Hot New Top + Random {{/equal}} {{#equal section "new"}} Hot New Top + Random {{/equal}} {{#equal section "top"}} Hot New Top + Random + {{/equal}} + {{#equal section "random"}} + Hot + New + Top + Random {{/equal}}