Class: Jekyll::Plugins::PaginateV3::Pagination::Pages::Document

Inherits:
Document
  • Object
show all
Defined in:
lib/jekyll-paginate-v3/pagination/pages/document.rb

Overview

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

Used by Pagination::Model when paginating collection documents.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template_item, current_page, total_pages, _index_filename, collection:) ⇒ Document

Clones a collection template document for one concrete page number.



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/document.rb', line 20

def initialize(template_item, current_page, total_pages, _index_filename, collection:)
	target_collection = collection
	source_path = template_path(template_item)
	extension = template_extname(template_item)
	virtual_path = build_virtual_path(template_item, target_collection, source_path, current_page, extension)

	initialise_document(template_item.site, target_collection, virtual_path)

	merge_data!(template_item.data)
	self.content = template_item.content
	self.data['pagination_info'] = {
		'curr_page' => current_page,
		'total_pages' => total_pages
	}
	@extname = extension
	self.data['path'] = source_path if current_page == 1 && !source_path.empty?

	trigger_hooks(:post_init)
end

Instance Attribute Details

#pagerObject

Returns the value of attribute pager.



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

def pager
  @pager
end