add dynamic sitemap.xml

This commit is contained in:
Albert Yi
2018-10-11 10:13:34 -07:00
parent 1a4949368c
commit 6ca9b65716
5 changed files with 52 additions and 56 deletions

View File

@@ -1,10 +1,11 @@
module PostSets
class Popular < PostSets::Base
attr_reader :date, :scale
attr_reader :date, :scale, :limit
def initialize(date, scale)
def initialize(date, scale, limit: nil)
@date = date.blank? ? Time.zone.now : Time.zone.parse(date)
@scale = scale
@limit = limit || CurrentUser.per_page
end
def posts
@@ -15,10 +16,6 @@ module PostSets
end
end
def limit
CurrentUser.user.per_page
end
def min_date
case scale
when "week"