Marp header, footer and page numbers: directives that work
In Marp, header:, footer: and paginate: true in the front matter put a header, a footer and a page number on every slide; <!-- _header: "" -->, <!-- _footer: "" --> and <!-- _paginate: false --> remove them from one slide. _paginate: skip hides the number and does not count the slide; hold shows the previous number. The footer takes inline Markdown, including an image, and the theme's CSS decides where everything sits.
This guide covers the three directives, the per-slide forms, the two pagination modes added for section slides, a logo in the footer, "page N of M", and the CSS that moves the header, the footer and the number. Every behaviour here was checked against marp-cli 4.5 (Marp Core 4.4).
The directives
---
marp: true
paginate: true
header: "CS101 · Operating systems · Week 5"
footer: "Silberschatz et al., 2018, ch. 5"
---
- header and footer are strings rendered on every slide, top-left and bottom-left in the built-in themes.
- paginate: true numbers the slides, bottom-right in the built-in themes.
They are global directives: set once at the top, they apply to the whole deck.
Per-slide overrides: the underscore form
Any directive with an underscore prefix in an HTML comment applies to that slide only:
---
<!-- _header: "" -->
<!-- _footer: "" -->
<!-- _paginate: false -->
# Scheduling
Week 5
---
<!-- _footer: "Figure: Tanenbaum & Bos, 2015, fig. 2-9" -->

# The convoy effect
The title slide above has no header, footer or number; the figure slide replaces the deck-wide footer with the figure's source line, which is the most useful thing a per-slide footer does in a lecture deck.
Without the underscore, a directive in a comment changes the value from that slide onwards. That is occasionally what you want (a new footer for the second half of the deck) and usually a mistake.
Page numbers on section slides: skip and hold
Two values besides true and false:
_paginate: |
Number shown | Counted |
|---|---|---|
true |
yes | yes |
false |
no | yes |
skip |
no | no |
hold |
yes, the previous number | no |
skip is for the title slide and section dividers: they neither show a number nor push the count, so "slide 12" means the twelfth content slide. hold is for a slide that continues the previous one (a second half of a table): it keeps the same number.
An image or Markdown in the footer
Header and footer accept inline Markdown:
---
footer: " **CS101** · Week 5"
---
A logo at 28 pixels beside bold text is the usual course footer. Keep the image in the deck's assets/ folder; the path is relative to the Markdown file, and marp-cli needs --allow-local-files to include local images in a PDF.
"Page 3 of 40"
The page number is drawn by the theme with a CSS pseudo-element. Add the total in a style: block or the theme:
section::after {
content: attr(data-marpit-pagination) " / " attr(data-marpit-pagination-total);
}
data-marpit-pagination-total is the count of numbered slides, so it respects skip.
Moving them: the CSS
The built-in themes position header, footer and the number with absolute positioning inside the slide. Override in the theme or a style: block:
header { top: 20px; left: 30px; right: 30px; font-size: 16px; color: #666; }
footer { bottom: 20px; left: 30px; font-size: 14px; color: #666; }
section::after { right: 30px; bottom: 20px; font-size: 14px; } /* the number */
footer { left: 0; right: 0; text-align: center; } /* centred footer */
Keep header and footer small and grey; they are for orientation and attribution, not reading. If the header collides with a slide's title, the slide's content area needs a larger top padding on section, not a smaller header.
In Lecture Studio
Lecture Studio's editor has a Directive menu with No page number, No header on this slide and No footer on this slide among its entries, the preview renders the directives as marp-cli does, and the scaffold for a new unit writes the front matter above for you: paginate: true, a header with the course code and title, and a footer with the unit and topic. The talk scaffold's title slide has no number, header or footer. The app runs on macOS 15 or later; the assistant needs an Oberik project key.
FAQ
How do I add a footer in Marp?
footer: "text" in the front matter for every slide, or <!-- _footer: "text" --> on one slide. Inline Markdown and images work in the string.
How do I remove the page number from the title slide?
<!-- _paginate: false --> hides it; <!-- _paginate: skip --> hides it and leaves it out of the count so the first content slide is 1.
How do I show "page N of M" in Marp?
Style section::after with content: attr(data-marpit-pagination) " / " attr(data-marpit-pagination-total) in the theme or a style: block.
Can I put a logo in the Marp header or footer?
Yes: header: " Course name". The image path is relative to the deck.