Add pinned posts
Branch feature/pinned-posts · version 0.5.0
What changed
- New
pinnedkey in a post's header block:pinned: truekeeps the post at the top of the index page. It's optional and defaults tofalse. - Several pinned posts are listed first, newest first, followed by every other post in date order.
- "Pinned" label: pinned posts show Pinned before the date on the index page, so a pinned post with an older date doesn't look out of order.
- "Why This Project Exists" is pinned.
- Docs: the hello-world guide, the About page and the README list
pinnedas the sixth header key. - Version: 0.5.0.
Notes
- Pinning only affects the index page. The RSS feed, the newer/older links on each post and the About page's "Latest post" stay in date order, so pinning a post doesn't reshuffle the reading chain.
- An invalid value such as
pinned: yesskips the post and logs the error, the same as an invaliddraftvalue. Accepted values aretrueandfalse(also1/0,t/f).
Testing
- All tests pass with the race detector (
go test -race ./...). - New test: pinned posts first and newest first among themselves, the rest by date, two "Pinned" labels, an invalid value skipped, and the newer/older links and feed unaffected.
- Built and ran locally with the real posts: "Why This Project Exists" is first with the Pinned label, and its "older" link still goes to the Go 1.27 post.
Screenshots
From the branch's build running locally.
| Desktop | Mobile |
|---|---|
![]() |
![]() |
🤖 Generated with Claude Code

