jekyll-paginate-content 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a368a5ecaaf041db59bbfccf429d4f3f99be19f
4
- data.tar.gz: 267e320de472fd9c29ee5f8983a429c6f16ecf55
3
+ metadata.gz: 072dcff2738413164040b9b5e8cfc4e06f0c0142
4
+ data.tar.gz: 05172f8814d8cf43d7646a7723ab1c33fceff0ea
5
5
  SHA512:
6
- metadata.gz: 1fc990bc920130af1e51a4128b95404b535d4124f6ce8516bc96aaf5ee45dc05bff8355ad7a11bc0e2e0e8e008f0116527688074f2b2f908c56f83909632207b
7
- data.tar.gz: 49259cc0c9a665344ff637b67530d6e507a5376b401b20f737517be079746988a6428948f40ba91144cb8d6fd922869d07e64871ef69a4f124cbc18eead83327
6
+ metadata.gz: 7a7d396dd2239d92fead8e728910c2e1049cb7466942372ed9fe1d31f9e76f384adc297f56d250126ca96dc056ccf909e31834f28670997cc4013d8dc5a19d9a
7
+ data.tar.gz: c9ec011450a938500412da3ce45470c2136b5ba62e806d5569e642257c9cc1b3bac267936a48955fb56a2652cf4ee1c0984234b9c397c5b30fbf24da436a0930
data/README.md CHANGED
@@ -27,7 +27,9 @@
27
27
  + [Overriding and restoring properties](#overriding-and-restoring-properties)
28
28
  - [Special values](#special-values)
29
29
  + [Default properties](#default-properties)
30
- + [Example](#example)
30
+ + [Example: blog](#example-blog)
31
+ + [Example: slides/presentation](#example-slidespresentation)
32
+ - [Last slide](#last-slide)
31
33
  * [Pagination trails](#pagination-trails)
32
34
  + [Usage](#usage-1)
33
35
  + [Page flipper](#page-flipper)
@@ -53,14 +55,7 @@ layout: page
53
55
  paginate: true
54
56
  ---
55
57
 
56
- {% if paginator.paginated %}
57
- <a href="{{ paginator.single_page }}">View as a single page</a>
58
- {% elsif paginator %}
59
- <a href="{{ paginator.first_path }}">View as {{ paginator.total_pages }} pages</a>
60
- {% endif %}
61
-
62
58
  This shows up at the top of all pages.
63
-
64
59
  <!--page_header-->
65
60
 
66
61
  This is page 1 of the JPC example.
@@ -70,10 +65,6 @@ This is page 1 of the JPC example.
70
65
  <!--page-->
71
66
  This is page 2 with a [link] to the first page which works in single or paged view.
72
67
 
73
- {% if paginator.paginated %}
74
- <p><a href="{{ paginator.next_path }}">Go on to page {{ paginator.next_page }}</a></p>
75
- {% endif %}
76
-
77
68
  <!--page-->
78
69
  This is the last page.
79
70
 
@@ -84,11 +75,11 @@ This goes into the bottom of all pages.
84
75
  ```
85
76
  [Live demo](https://ibrado.org/demos/jpc-3page-manual)
86
77
 
87
- ### Automatic, with config overrides and mixed syntax
78
+ ### Automatic, with config overrides
88
79
 
89
80
  ```markdown
90
81
  ---
91
- title: "JPC demo: 3-page auto, mixed syntax"
82
+ title: "JPC demo: 3-page auto"
92
83
  layout: page
93
84
  paginate: true
94
85
  paginate_content:
@@ -97,26 +88,18 @@ paginate_content:
97
88
  permalink: /page:numof:max.html
98
89
  ---
99
90
 
100
- <h2>Introduction</h2>
91
+ # Introduction
92
+
101
93
  Hello!
102
94
 
103
95
  ## What did something?
96
+
104
97
  The quick brown fox...
105
98
 
106
- What did it do?
107
- ---------------
99
+ ## What did it do?
100
+
108
101
  ...jumped over the lazy dog.
109
102
 
110
- <!--page_footer-->
111
- <div>
112
- {% if paginator.prev_section %}
113
- &laquo; <a href="{{ paginator.prev_path }}">{{ paginator.prev_section }}</a>
114
- {% endif %}
115
- {% if paginator.prev_section and paginator.next_section %} | {% endif %}
116
- {% if paginator.next_section %}
117
- <a href="{{ paginator.next_path }}">{{ paginator.next_section }}</a> &raquo;
118
- {% endif %}
119
- </div>
120
103
  ```
121
104
 
122
105
  [Live demo](https://ibrado.org/demos/jpc-3page-auto)
@@ -127,12 +110,14 @@ See other [demos](#demos).
127
110
 
128
111
  1. You want to split long posts and pages/articles/reviews, etc. into multiple pages, e.g. chapters;
129
112
  1. You want to offer faster loading times to your readers;
130
- 1. You want to make slide/presentation-type content;
113
+ 1. You want to make slide/presentation-type content (see [demo](https://ibrado.org/jpc/slides/)!)
131
114
  1. You want more ad revenue from your Jekyll site;
132
115
  1. You wanna be the cool kid. :stuck_out_tongue:
133
116
 
134
117
  ## What's new?
135
118
 
119
+ v1.1.0 Layout overrides for e.g. slides; regenerate and other fixes
120
+
136
121
  v1.0.4 Allow inclusion in `_config.yml` plugins
137
122
 
138
123
  v1.0.3 Bugfixes; force option
@@ -400,7 +385,6 @@ These properties/fields are available to your layouts and content via the `pagin
400
385
  | `page` | `page_num` | Current page number |
401
386
  | `page_path` | | Path to the current page |
402
387
  | `page_trail` | | Page trail, see [below](#pagination-trails) |
403
- | `paginated` | `activated` | `true` if this is a partial page |
404
388
  | `total_pages` | `pages` | Total number of pages |
405
389
  | | | |
406
390
  | `single_page` | `view_all` | Path to the original/full page |
@@ -408,9 +392,11 @@ These properties/fields are available to your layouts and content via the `pagin
408
392
  | `toc` | | Table Of Contents generator, see [below](#table-of-contents-toc)
409
393
  | | | |
410
394
  | `section` | | Text of the first header (&lt;h1&gt; etc.) on this page
395
+ | `section_id` | | The header id (`<a name>`) of this section
411
396
  | `previous_section` | `prev_section` | Ditto for the previous page |
412
397
  | `next_section` | | Ditto for the next page |
413
398
  | | | |
399
+ | `paginated` | `activated` | `true` if this is a partial page |
414
400
  | `has_next` | | `true` if there is a next page |
415
401
  | `has_previous` | `has_prev` | `true` if there is a previous page |
416
402
  | `is_first` | | `true` if this is the first page |
@@ -476,7 +462,7 @@ paginate_content:
476
462
 
477
463
  In your layout, you'd use something like
478
464
 
479
- ```html
465
+ ```liquid
480
466
  {% if post.comments %}
481
467
  <!-- Disqus section -->
482
468
  {% endif %}
@@ -486,7 +472,7 @@ The single-page view would then show the [Disqus](https://disqus.com/) comments
486
472
 
487
473
  ### Overriding and restoring properties
488
474
 
489
- You can set almost any front-matter property via the `properties` section, except for `title`, `layout`, `date`, `permalink`, and `pagination_info`. Use with caution.
475
+ You can set almost any front-matter property via the `properties` section, except for `title`, `date`, `permalink`, and `pagination_info`. Use with caution.
490
476
 
491
477
  #### Special values
492
478
 
@@ -541,7 +527,7 @@ For reference, the default properties effectively map out to:
541
527
  type: 'single'
542
528
  ```
543
529
 
544
- ### Example
530
+ ### Example: blog
545
531
 
546
532
  The author's `_config.yml` has the following:
547
533
 
@@ -576,7 +562,7 @@ The author's `_config.yml` has the following:
576
562
 
577
563
  `x_title` saves the original title for use in social media sharing. The example below also does something similar for the URL to be shared:
578
564
 
579
- ```
565
+ ```liquid
580
566
  {% if page.x_title %}
581
567
  {% assign share_title = page.x_title %}
582
568
  {% else %}
@@ -590,6 +576,52 @@ The author's `_config.yml` has the following:
590
576
  {% endif %}
591
577
  ```
592
578
 
579
+ ### Example: slides/presentation
580
+
581
+ JPC can be used to generate slides as well as a detailed document from the same source Markdown, i.e.
582
+
583
+ ```liquid
584
+ {% if paginator.paginated %}
585
+ // Content that only shows up in the slides
586
+ {% else %}
587
+ // Content that only shows up in the single/details page.
588
+ {% endif %}
589
+ ```
590
+
591
+ Or alternatively,
592
+
593
+ ```liquid
594
+ {% if paginator.paginated %}
595
+ // Content that only shows up in the slides
596
+ {% endif %}
597
+ ```
598
+
599
+ and
600
+
601
+ ```liquid
602
+ {% unless paginator.paginated %}
603
+ // Content that only shows up in the single/details page.
604
+ {% endif %}
605
+ ```
606
+
607
+ Here's an example configuration:
608
+
609
+ ```yaml
610
+ properties:
611
+ all:
612
+ layout: slides
613
+ single:
614
+ layout: $
615
+ ```
616
+
617
+ This makes all pages except the single-page view use the `slides` layout. The latter will use the original layout.
618
+
619
+ #### Last slide
620
+
621
+ When using JPC to generate slides, you may use `_last_` as the title for the last slide (usually a "thank you" or contact info slide). It will be removed and hidden from the TOC.
622
+
623
+ The [demos](#demos) include a sample presentation.
624
+
593
625
  ## Pagination trails
594
626
 
595
627
  You use `paginator.page_trail` to create a pager that will allow your readers to move from page to page. It is set up as follows:
@@ -628,7 +660,7 @@ Let's say your document has 7 pages, and you have a `trail` as above. The pager
628
660
 
629
661
  Here is an example adapted from [JPv2's documentation](https://github.com/sverrirs/jekyll-paginate-v2/blob/master/README-GENERATOR.md#creating-pagination-trails). Note that you don't need to prepend `site.baseurl` to `trail.path` as it is automatically added in by JPC [by default](#sitebaseurl).
630
662
 
631
- ```html
663
+ ```liquid
632
664
  {% if paginator.page_trail %}
633
665
  <ul class="pager">
634
666
  {% for trail in paginator.page_trail %}
@@ -658,7 +690,7 @@ You'll end up with something like this, for page 4:
658
690
 
659
691
  The author's own pager is a little more involved and uses some convenience fields and aliases:
660
692
 
661
- ```html
693
+ ```liquid
662
694
  {% if paginator.page_trail %}
663
695
  <div class="pager">
664
696
  {% if paginator.is_first %}
@@ -702,7 +734,7 @@ This results in a pager that looks like this:
702
734
 
703
735
  You may also want to add a page "flipper" that uses section names:
704
736
 
705
- ```html
737
+ ```liquid
706
738
  <!--page_footer-->
707
739
  <div>
708
740
  {% if paginator.previous_section %}
@@ -717,7 +749,7 @@ You may also want to add a page "flipper" that uses section names:
717
749
 
718
750
  Should there be no available section name, "Untitled" will be returned. You can then handle it like so:
719
751
 
720
- ```html
752
+ ```liquid
721
753
  {% if paginator.previous_section == "Untitled" %}
722
754
  Previous
723
755
  {% else %}
@@ -727,7 +759,7 @@ Should there be no available section name, "Untitled" will be returned. You can
727
759
 
728
760
  Of course, you always have the option of adding some navigational cues to your content:
729
761
 
730
- ```html
762
+ ```liquid
731
763
  {% if paginator.paginated %}
732
764
  <a href="{{ paginator.next_page_path }}">On to the next chapter...</a>
733
765
  {% endif %}
@@ -739,13 +771,13 @@ This text will not appear in the single-page view.
739
771
 
740
772
  JPC automatically generates a Table of Contents for you. To use this from within your content, simply insert the following:
741
773
 
742
- ```
774
+ ```liquid
743
775
  {{ paginator.toc.simple }}
744
776
  ```
745
777
 
746
778
  If you want to use this from an HTML layout, e.g. an included `sidebar.html`:
747
779
 
748
- ```
780
+ ```liquid
749
781
  {{ paginator.toc.simple | markdownify }}
750
782
  ```
751
783
 
@@ -793,7 +825,7 @@ Now that your site features split pages (*finally!*), how do you optimize it for
793
825
 
794
826
  You could simply add the following somewhere inside the <tt>&lt;head&gt;</tt> of your document:
795
827
 
796
- ```
828
+ ```liquid
797
829
  {{ paginator.seo.links }}
798
830
  ```
799
831
 
@@ -811,7 +843,7 @@ It will produce up to three lines, like so (assuming you are on page 5):
811
843
 
812
844
  It would be better to use the following approach, though:
813
845
 
814
- ```html
846
+ ```liquid
815
847
  {% unless paginator %}
816
848
  <link rel="canonical" href="{{ site.canonical }}{{ site.baseurl }}{{ page.url }}" />
817
849
  {% endunless %}
@@ -836,6 +868,7 @@ What about `canonical` for JPv2-generated pages? Unless you have a "view-all" pa
836
868
  1. TL;DR demos: [manual](https://ibrado.org/demos/jpc-3page-manual/), [automatic](https://ibrado.org/demos/jpc-3page-auto/)
837
869
  1. Simple example as a [post](https://ibrado.org/2017/12/jpc-demo-post/), as an item in a [collection](https://ibrado.org/demos/jpc/), and as a [page](https://ibrado.org/jpc-demo/).
838
870
  1. [This README](https://ibrado.org/jpc/readme/), autopaginated
871
+ 1. [Simple Slides in Jekyll](https://ibrado.org/jpc/slides/)
839
872
 
840
873
  ## Limitations
841
874
 
@@ -0,0 +1,3 @@
1
+ _site
2
+ .sass-cache
3
+ .jekyll-metadata
@@ -0,0 +1,24 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ <style type="text/css" media="screen">
6
+ .container {
7
+ margin: 10px auto;
8
+ max-width: 600px;
9
+ text-align: center;
10
+ }
11
+ h1 {
12
+ margin: 30px 0;
13
+ font-size: 4em;
14
+ line-height: 1;
15
+ letter-spacing: -1px;
16
+ }
17
+ </style>
18
+
19
+ <div class="container">
20
+ <h1>404</h1>
21
+
22
+ <p><strong>Page not found :(</strong></p>
23
+ <p>The requested page could not be found.</p>
24
+ </div>
@@ -0,0 +1,28 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Hello! This is where you manage which Jekyll version is used to run.
4
+ # When you want to use a different version, change it below, save the
5
+ # file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
6
+ #
7
+ # bundle exec jekyll serve
8
+ #
9
+ # This will help ensure the proper Jekyll version is running.
10
+ # Happy Jekylling!
11
+ gem "jekyll", "~> 3.6.2"
12
+
13
+ # This is the default theme for new Jekyll sites. You may change this to anything you like.
14
+ gem "minima", "~> 2.0"
15
+
16
+ # If you want to use GitHub Pages, remove the "gem "jekyll"" above and
17
+ # uncomment the line below. To upgrade, run `bundle update github-pages`.
18
+ # gem "github-pages", group: :jekyll_plugins
19
+
20
+ # If you have any plugins, put them here!
21
+ group :jekyll_plugins do
22
+ gem "jekyll-feed", "~> 0.6"
23
+ gem "jekyll-paginate-content"
24
+ end
25
+
26
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
27
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
28
+
@@ -0,0 +1,54 @@
1
+ # Welcome to Jekyll!
2
+ #
3
+ # This config file is meant for settings that affect your whole blog, values
4
+ # which you are expected to set up once and rarely edit after that. If you find
5
+ # yourself editing this file very often, consider using Jekyll's data files
6
+ # feature for the data you need to update frequently.
7
+ #
8
+ # For technical reasons, this file is *NOT* reloaded automatically when you use
9
+ # 'bundle exec jekyll serve'. If you change this file, please restart the server process.
10
+
11
+ # Site settings
12
+ # These are used to personalize your new site. If you look in the HTML files,
13
+ # you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
14
+ # You can create any custom variable you would like, and they will be accessible
15
+ # in the templates via {{ site.myvariable }}.
16
+ title: "Jekyll::Paginate::Content"
17
+ email: jekyll@ibrado.org
18
+ description: >- # this means to ignore newlines until "baseurl:"
19
+ Split your Jekyll pages, posts, etc. into multiple pages
20
+ automatically. Single-page view, pager, SEO support, self-adjusting links,
21
+ multipage-aware Table Of Contents, more.
22
+ baseurl: "" # the subpath of your site, e.g. /blog
23
+ url: "" # the base hostname & protocol for your site, e.g. http://example.com
24
+ twitter_username: ibrado
25
+ github_username: ibrado
26
+
27
+ # Build settings
28
+ markdown: kramdown
29
+ theme: minima
30
+ plugins:
31
+ - jekyll-feed
32
+ - jekyll-paginate-content
33
+
34
+ collections:
35
+ demos:
36
+ output: true
37
+ permalink: /demos/:path/
38
+
39
+ paginate_content:
40
+ debug: true
41
+ collections: pages, posts, demos
42
+
43
+
44
+ # Exclude from processing.
45
+ # The following items will not be processed, by default. Create a custom list
46
+ # to override the default setting.
47
+ # exclude:
48
+ # - Gemfile
49
+ # - Gemfile.lock
50
+ # - node_modules
51
+ # - vendor/bundle/
52
+ # - vendor/cache/
53
+ # - vendor/gems/
54
+ # - vendor/ruby/
@@ -0,0 +1,19 @@
1
+ ---
2
+ title: "JPC demo: 3-page auto, mixed syntax"
3
+ layout: page
4
+ paginate_content:
5
+ separator: h2
6
+ title: ":title :num/:max"
7
+ permalink: /page:numof:max.html
8
+ ---
9
+
10
+ <h2>Introduction</h2>
11
+ Hello!
12
+
13
+ ## What did something?
14
+ The quick brown fox...
15
+
16
+ What did it do?
17
+ ---------------
18
+ ...jumped over the lazy dog.
19
+
@@ -0,0 +1,34 @@
1
+ <header class="site-header" role="banner">
2
+
3
+ <div class="wrapper">
4
+ {% assign default_paths = site.pages | map: "path" %}
5
+ {% assign page_paths = site.header_pages | default: default_paths %}
6
+ <a class="site-title" rel="author" href="{{ "/" | relative_url }}">{{ site.title | escape }}</a>
7
+
8
+ {% if page_paths %}
9
+ <nav class="site-nav">
10
+ <input type="checkbox" id="nav-trigger" class="nav-trigger" />
11
+ <label for="nav-trigger">
12
+ <span class="menu-icon">
13
+ <svg viewBox="0 0 18 15" width="18px" height="15px">
14
+ <path fill="#424242" d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.031C17.335,0,18,0.665,18,1.484L18,1.484z"/>
15
+ <path fill="#424242" d="M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0c0-0.82,0.665-1.484,1.484-1.484 h15.031C17.335,6.031,18,6.696,18,7.516L18,7.516z"/>
16
+ <path fill="#424242" d="M18,13.516C18,14.335,17.335,15,16.516,15H1.484C0.665,15,0,14.335,0,13.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.031C17.335,12.031,18,12.696,18,13.516L18,13.516z"/>
17
+ </svg>
18
+ </span>
19
+ </label>
20
+
21
+ {% assign page_paths = page_paths | uniq %}
22
+
23
+ <div class="trigger">
24
+ {% for path in page_paths %}
25
+ {% assign my_page = site.pages | where: "path", path | first %}
26
+ {% if my_page.title %}
27
+ <a class="page-link" href="{{ my_page.url | relative_url }}">{{ my_page.title | escape }}</a>
28
+ {% endif %}
29
+ {% endfor %}
30
+ </div>
31
+ </nav>
32
+ {% endif %}
33
+ </div>
34
+ </header>