Method: Paginator::LinkHelpers#pages

Defined in:
lib/middleman/paginator/link_helpers.rb

#pages(count: 5) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/middleman/paginator/link_helpers.rb', line 39

def pages(count: 5)
  pages_group = Paginator::PagesGroup.new(
    current: @locs[:paginator][:page], last: @locs[:paginator][:last_page], count: count
  )

  pages_group.generate do |page_number|
    page_name = page_number == 1 ? 'index.html' : "pages/#{page_number}.html"
    path = @locs[:paginator][:destination] + page_name

    yield(page_number, path) if block_given?
  end
end