Sha256: 5f5adbc8b7501202852b6ccb8407b2ec863b71a08c55eb51d9ddb0b0ff056b07
Contents?: true
Size: 986 Bytes
Versions: 30
Compression:
Stored size: 986 Bytes
Contents
class ArchivePage < Page description %{ An archive page provides behavior similar to a blog archive or a news archive. Child page URLs are altered to be in %Y/%m/%d format (2004/05/06). An archive page can be used in conjunction with the "Archive Year Index", "Archive Month Index", and "Archive Day Index" page types to create year, month, and day indexes. } def child_url(child) date = child.published_at || Time.now clean_url "#{ url }/#{ date.strftime '%Y/%m/%d' }/#{ child.slug }" end def find_by_url(url, live = true, clean = false) url = clean_url(url) if clean if url =~ %r{^#{ self.url }(\d{4})(?:/(\d{2})(?:/(\d{2}))?)?/?$} year, month, day = $1, $2, $3 children.find_by_class_name( case when day 'ArchiveDayIndexPage' when month 'ArchiveMonthIndexPage' else 'ArchiveYearIndexPage' end ) else super end end end
Version data entries
30 entries across 30 versions & 3 rubygems