Usage
Just add a paginate: true
entry to your front-matter:
---
title: Test post
layout: post
date: 2017-12-15 22:33:44
paginate: true
---
or set auto
to true
in your _config.yml
:
paginate_content:
auto: true
Note that using auto
mode might be slower on your machine.
You may also override _config.yml
settings for a particular file like so:
---
title: Test page
layout: page
paginate_content:
permalink: '/page:numof:max.html'
single_page: '/full.html'
---
You don’t need to specify paginate: true
if you already have paginate_content
in your front matter.
Splitting content
How your content is split depends on your separator
:
Manual mode
If your separator
is "<!--page-->"
, just put that wherever you want a split to occur:
This is a page.
<!--page-->
This is another page.
HTML header mode
If you set your header to “h1” up to “h6”, your files will be split at those headers. Both the standard atx
and Setext
formats are supported – the former uses 1 to 6 hashes (#
to ######
) at the start for <h1> to <h6>, while the later uses equals-underscores for <h1> and dash-underscores for <h2>
For example, if your separator is "h1"
:
# Introduction
This is a page.
Discussion
==========
This is another page
## Point 1
This is not.
Point 2
-------
Neither is this
<h1>Conclusion</h1>
But this is.
At this time, you’ll need at least 4 dashes for Setext-style <h2>. Note that Setext only supports <h1> and <h2>.
Page headers and footers
Anything above your configured header
string will appear at the top of the generated pages. Likewise, anything after your footer
string will appear at the bottom.
This is the header
<!--page_header-->
This is a page.
<!--page-->
This is another page.
<!--page_footer-->
This is the footer.
If you split your links like so:
This is a [link].
[link]: https://example.com
make sure you put these referenced link definitions below the footer
so that references to them will work across pages.
Minimum page length
You may set the minimum length (in characters) using the minimum
property in _config.yml
or your front-matter. Should a particular section be too short, the next section will be merged in, and so on until the minimum is reached or there are no more pages.
Note that this length includes markup, not just the actual displayed text, so you may want to take that into consideration. A minimum of 1000 to 2000 should work well.