linkrobins / post-num
Adds a #N number to each post in a discussion. Ported to Flarum 2.0 from ziven/flarum-post-number.
Package info
github.com/linkrobins/post-num
Language:TypeScript
Type:flarum-extension
pkg:composer/linkrobins/post-num
Requires
- php: ^8.3
- flarum/core: ^2.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This extension is retired. It still works and the existing versions stay installable, but it won't get updates or fixes. Use Prominent Post Numbers by Clark Winkelmann instead: it does the same job on Flarum 2 and adds post numbers in mentions, a custom prefix, and a setting to show the number on the right.
To switch:
composer remove linkrobins/post-num, thencomposer require clarkwinkelmann/flarum-ext-prominent-post-numbers, thenphp flarum cache:clear.
Adds a #1, #2, #3... number to each post in a discussion. Helpful for referring to specific posts ("see #4 above") and giving readers a sense of where they are in a long thread.
Ported to Flarum 2.0 from ziven/flarum-post-number (MIT).
What it does
Extends CommentPost.headerItems to append a small #N label to each post's header, where N is the post's sequence number within its discussion. Hidden posts are skipped, matching the original extension's behavior.
What it counts
The number comes from Flarum's own per-discussion post number, not a count the extension keeps. That has two consequences worth knowing:
- Numbers are stable. A post keeps its number for the life of the discussion, so
#42in a quoted link still points at the same post later. - Numbers can have gaps. Deleting a post does not renumber the ones after it. A discussion that has had posts removed will skip numbers, which is correct — renumbering would break every existing deep link.
Hidden posts are skipped entirely: if a post is hidden, no number is rendered for it rather than a number for something you cannot read.
What it does NOT do
- No settings and no migrations.
- It does not renumber, or offer a "count only visible posts" mode — see the gap behaviour above.
- It does not add its own permalink or anchor. Flarum's post menu already has "Permalink", and the number sits next to it rather than duplicating it.
Styling
The number renders as a <span class="LinkRobinsPostNum"> in the post header, alongside the timestamp. Restyle it from your theme's custom LESS:
.LinkRobinsPostNum { opacity: .5; font-variant-numeric: tabular-nums; }
Requirements
- Flarum 2.0 or later
- PHP 8.3 or later
Installation
composer require linkrobins/post-num
php flarum cache:clear
In Flarum admin → Extensions, find Link Robins Post Numbers and enable it. No configuration needed.
What changed from the 1.x original
The original extension targeted Flarum 1.x and relied on a webpack/JSX build pipeline. This 2.0 port:
- Targets
flarum/core ^2.0 - Uses the runtime
extend()helper from the export registry with string-path lazy module resolution, so no JSX/build step is required - Uses the canonical 2.0 model accessors (
post.number(),post.isHidden()) with fallback to raw attribute access for resilience - Renames the CSS class to
LinkRobinsPostNumto avoid colliding with the original if both are ever installed side-by-side - Adds tabular-numeric digit alignment so post numbers stay column-aligned in lists
Translation strings follow the same shape — the only difference is the namespace key.
License
MIT. Credit to the original author for the design.