Class: Jekyll::Plugins::PaginateV3::Pagination::Pages::Page

Inherits:
Jekyll::Page
  • Object
show all
Defined in:
lib/jekyll-paginate-v3/pagination/pages/page.rb

Overview

In-memory index page generated from a pagination template for a specific page number.

Used by Pagination::Model to emit page-based pagination output.

Direct Known Subclasses

ShadowPage

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template_item, current_page, total_pages, index_filename) ⇒ Page

Clones template content/data and annotates it with pagination metadata.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/jekyll-paginate-v3/pagination/pages/page.rb', line 18

def initialize(template_item, current_page, total_pages, index_filename)
	@site = template_item.site
	@base = template_base_path(template_item)
	@dir = template_directory(template_item)
	@url = nil
	@name = index_filename.to_s.empty? ? 'index.html' : index_filename

	process(@name)

	self.data = Jekyll::Utils.deep_merge_hashes(template_item.data, {})
	self.content = template_item.content
	self.data['pagination_info'] = {
		'curr_page' => current_page,
		'total_pages' => total_pages
	}
	self.ext = template_extname(template_item)
	self.data['path'] = template_path(template_item) if current_page == 1

	validate_data!(template_path(template_item))
	validate_permalink!(template_path(template_item))
end

Instance Attribute Details

#pagerObject

Returns the value of attribute pager.



15
16
17
# File 'lib/jekyll-paginate-v3/pagination/pages/page.rb', line 15

def pager
  @pager
end