Home

Add pinned posts

Release #007

Branch feature/pinned-posts · version 0.5.0

What changed

  • New pinned key in a post's header block: pinned: true keeps the post at the top of the index page. It's optional and defaults to false.
  • 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 pinned as 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: yes skips the post and logs the error, the same as an invalid draft value. Accepted values are true and false (also 1/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
Desktop Mobile

🤖 Generated with Claude Code