Block
Page number
A small automatic line that prints the current page number — the document counts the pages for you, so you never type a number.
What it is for
A Page number is a one-line block whose text is filled in as the document is produced. You write the wording once, such as "Page 1 of 4", with placeholders where the numbers go, and every page gets its own correct values. Its natural home is a header or footer, so it repeats on every page of a section.
Choose something else when you need more than a small line of numbers. The block is deliberately thin: it has no font choice, no italic, no line-height setting and no justified alignment. If you need those, use a Text block with the same placeholders. If you only want a fixed label such as a document title in the footer, use a Text block too; see Headers and footers.
Add and edit it
The usual way to add one is from the Section tab: turn on the header (or footer) and press + Add page number. You can also pick Page number from the Layout group of the block palette, or search for "page x of y".
Double-click the block on the page to edit the wording in place. While you type you see the raw
placeholders, for example {{ $page.number }}, not "3", so a stray keystroke can never turn a live
page number into a fixed one. When you are not editing, the page already shows the real numbers: the
editor paginates the document the same way the finished file does, so what you see is what prints.
Use the block's own menu (⋮) to duplicate or delete it.
Settings
- Wording. The text with placeholders. The default is
{{ $page.number }} / {{ $page.count }}, which prints as "1 / 4". - Font size (points; default 9). Smaller than body text, so it reads as a footer note.
- Bold: Normal (default) or Bold.
- Alignment: Left, Center (default) or Right inside the block's box. Right suits a footer that already carries something on the left.
- Color (default soft grey
#444444).
The text always uses the template's default font. The general sections (Box, Visibility) apply as for any block.
The four placeholders
Write them exactly, including the double curly brackets. Each page fills in its own values.
| Placeholder | What it prints |
|---|---|
{{ $page.number }} |
This page's number counted over the whole document. |
{{ $page.count }} |
How many pages the whole document has. |
{{ $page.sectionNumber }} |
This page's number counted within its own section, starting again at 1 in each section. |
{{ $page.sectionCount }} |
How many pages that section has. |
A section is a unit of the document with its own page setup and header/footer; see Sections. In a document with a single section, the section numbers equal the document numbers. You can mix them: "Page {{ $page.sectionNumber }} of {{ $page.sectionCount }} (document page {{ $page.number }})".
Header or footer versus the body
Put the block in a header or footer to repeat it on every page of that section. Put it in the body and it behaves like any other block: it appears once, where you put it, with that page's number.
Variations and combinations
Centred footer, default wording. A footer with the default Page number. The example is
page-number-1.json: a two-page document ("Report / First page." then a page break and "Second
page."). Page 1's footer reads "1 / 2" and page 2's reads "2 / 2", centred in grey.
Right-aligned "Page N of total", in bold. Wording Page {{ $page.number }} of {{ $page.count }},
Alignment Right, Bold. The example is page-number-2.json, a three-page document; the footers read
"Page 1 of 3", "Page 2 of 3" and "Page 3 of 3" at the right margin.
Numbering that restarts in each section. Two sections of two pages each, wording
Page {{ $page.sectionNumber }} of {{ $page.sectionCount }}. The example is page-number-3.json.
The four footers read "Page 1 of 2", "Page 2 of 2", then, in the second section, "Page 1 of 2" and
"Page 2 of 2" again, while the document as a whole has four pages.
Output differences
- PDF and web page (HTML). The numbers are printed as the layout resolved them.
- Word (.docx). The header or footer is a real Word header or footer, but the number is the plain text that the layout worked out, not a Word page-number field. If someone adds or removes pages by editing the Word file, these numbers will not update by themselves.
Troubleshooting
- The number is missing or wrong. Check the placeholder against the table above: the name must
be spelled exactly, with double curly brackets, and
number/countcount the whole document whilesectionNumber/sectionCountcount one section. - It says "1 / 1" on every page. The document, or the section you are counting in, has one page.
- A number appears only once. The block is in the body. Move it into the header or footer.
- I want a different style, such as italic or a different font. Use a Text block with the same placeholders.
- Numbers do not match after I edited the Word file. See Output differences.