jekyll-paginate-v2 1.7.2 → 1.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ce2b9e1db9613c363b49bd85abcde999a711f92
4
- data.tar.gz: 4e1437c8cf70f5bc127db725e3b3ddb8b3993aac
3
+ metadata.gz: 16960246c340b15c1c92a75fff4edab91d9a87ce
4
+ data.tar.gz: 19a9d469619d6411c76e223f1e133368c6ad25b0
5
5
  SHA512:
6
- metadata.gz: bf461c4d569da1753e223721f06092d6f54c1fefe59910531bcaab16daa39af8494278527d984cb5c34e4ec4e1bf3da1a0f8869cdac364a75a0063e52da7afd1
7
- data.tar.gz: 88df86ce35916323d5caf29f23bcb15e8a10f5607f91bc46a2f2de94823cc6a3957bfd1449bd55f3ab0da9e7774bfc80a6d30c9669a1d0312b6916e0fa9466cb
6
+ metadata.gz: 35b366f65415ad461745f24a004ab16da5048c52a8288659b996720b1e2853212ce6e189f0e8151086c39853ebf9488284f7f12e4125909a7213fddcded6f28a
7
+ data.tar.gz: e72a69dcbc1b19d8bf61ad9d34d68127485f9c19690b2ce14251b3faa82c89f027575c8e233142fcd95cc2e5f5c6849afbdb876c7564ceb22ff746fb4a63088e
@@ -10,9 +10,12 @@
10
10
  > This feature is based on [code](https://github.com/stevecrozz/lithostech.com/blob/master/_plugins/tag_indexes.rb) written and graciously donated by [Stephen Crosby](https://github.com/stevecrozz). Thanks! :)
11
11
 
12
12
  * [Site configuration](#site-configuration)
13
+ * [Simple configuration](#simple-configuration)
14
+ + [Obtaining the original Tag or Category name](#obtaining-the-original-tag-or-category-name)
13
15
  * [Advanced configuration](#advanced-configuration)
14
16
  * [Specialised pages](#specialised-pages)
15
17
  * [Considerations](#considerations)
18
+ + [Title should not contain pagination macros](#title-should-not-contain-pagination-macros)
16
19
  * [Example Sites](https://github.com/sverrirs/jekyll-paginate-v2/tree/master/examples)
17
20
  * [Common issues](#common-issues)
18
21
 
@@ -25,6 +25,7 @@ The **Generator** forms the core of the pagination logic. It is responsible for
25
25
  * [Creating Pagination Trails](#creating-pagination-trails)
26
26
  * [How to detect auto-generated pages](#detecting-generated-pagination-pages)
27
27
  * [Formatting page titles](#formatting-page-titles)
28
+ * [Reading pagination meta information](#reading-pagination-meta-information)
28
29
  * [Common issues](#common-issues)
29
30
  - [Dependency Error after installing](#i-keep-getting-a-dependency-error-when-running-jekyll-serve-after-installing-this-gem)
30
31
  - [Bundler error upgrading gem (Bundler::GemNotFound)](#im-getting-a-bundler-error-after-upgrading-the-gem-bundlergemnotfound)
@@ -441,6 +442,21 @@ The `title` field in both the site.config and the front-matter configuration sup
441
442
  | :num | number of the current page | Page with `title: "Index"` and paginate config `title: ":title (page :num)"` the second page becomes `<title>Index (page 2)</title>` |
442
443
  | :max | total number of pages | Page with paginate config `title: ":num of :max"` the third page of 10 will become `<title>3 of 10</title>"` |
443
444
 
445
+ ## Reading pagination meta information
446
+ Each pagination page defines an information structure `pagination_info` that is available to the liquid templates. This structure contains meta information for the pagination process, such as current pagination page and the total number of paginated pages.
447
+
448
+ The following fields are available
449
+ | Field | Description |
450
+ | --- | --- |
451
+ | curr_page | The number of the current pagination page |
452
+ | total_pages | The total number of pages in this pagination |
453
+
454
+ Below is an example on how to print out a "Page x of n" in the pagination layout
455
+
456
+ ``` html
457
+ <h2>Page {{page.pagination_info.curr_page}} of {{page.pagination_info.total_pages}}</h2>
458
+ ```
459
+
444
460
  ## Common issues
445
461
 
446
462
  ### I keep getting a dependency error when running jekyll serve after installing this gem
@@ -245,7 +245,7 @@ module Jekyll
245
245
 
246
246
  # 1. Create the in-memory page
247
247
  # External Proc call to create the actual page for us (this is passed in when the pagination is run)
248
- newpage = PaginationPage.new( template, true )
248
+ newpage = PaginationPage.new( template, cur_page_nr, total_pages )
249
249
 
250
250
  # 2. Create the url for the in-memory page (calc permalink etc), construct the title, set all page.data values needed
251
251
  paginated_page_url = config['permalink']
@@ -9,7 +9,7 @@ module Jekyll
9
9
  # This page exists purely in memory and is not read from disk
10
10
  #
11
11
  class PaginationPage < Page
12
- def initialize(page_to_copy, ignored)
12
+ def initialize(page_to_copy, cur_page_nr, total_pages)
13
13
  @site = page_to_copy.site
14
14
  @base = ''
15
15
  @url = ''
@@ -30,6 +30,9 @@ module Jekyll
30
30
  end
31
31
  end
32
32
 
33
+ # Store the current page and total page numbers in the pagination_info construct
34
+ self.data['pagination_info'] = {"curr_page" => cur_page_nr, 'total_pages' => total_pages }
35
+
33
36
  # Perform some validation that is also performed in Jekyll::Page
34
37
  validate_data! page_to_copy.path
35
38
  validate_permalink! page_to_copy.path
@@ -1,8 +1,10 @@
1
1
  module Jekyll
2
2
  module PaginateV2
3
- VERSION = "1.7.2"
3
+ VERSION = "1.7.3"
4
4
  # When modifying remember to issue a new tag command in git before committing, then push the new tag
5
- # git tag -a v1.7.2 -m "Gem v1.7.2"
6
- # git push origin --tags
5
+ # git tag -a v1.7.3 -m "Gem v1.7.3"
6
+ # git push origin --tags
7
+ # Yanking a published Gem
8
+ # gem yank jekyll-paginate-v2 -v VERSION
7
9
  end # module PaginateV2
8
10
  end # module Jekyll
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-paginate-v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sverrir Sigmundarson