Hide draft articles from the front page and mark drafts when viewed directly #140

Merged
jonny merged 1 commit from draft_posts_page_tweak into develop 2026-09-26 17:29:30 +02:00
Owner

Summary

  • Adds an Article::published() scope and uses it on the front page, the /blog listing and the JSON/JF2 feeds. The front page was the only place that showed drafts; the others already filtered on published and now share the scope.
  • Draft articles can still be opened at their URL (e.g. after publishing a draft from iA Writer), but now show:
    • a "Draft" notice above the post,
    • a [Draft] prefix in the page title,
    • a noindex, nofollow robots meta tag.
  • Adds @stack('head') to the master layout so individual views can push tags into <head>.
  • The scope compares published with 1 because the column is a smallint in Postgres.

Testing

  • New feature tests: drafts are hidden from the front page and /blog; a draft shows the notice, title prefix and noindex tag; a published article shows none of them.
  • sail test: 384 passed.
  • npm run build (lint + CSS/JS build + compression) is clean; the rebuilt assets in public/assets/css are included.

🤖 Generated with Claude Code

## Summary - Adds an `Article::published()` scope and uses it on the front page, the `/blog` listing and the JSON/JF2 feeds. The front page was the only place that showed drafts; the others already filtered on `published` and now share the scope. - Draft articles can still be opened at their URL (e.g. after publishing a draft from iA Writer), but now show: - a "Draft" notice above the post, - a `[Draft]` prefix in the page title, - a `noindex, nofollow` robots meta tag. - Adds `@stack('head')` to the master layout so individual views can push tags into `<head>`. - The scope compares `published` with `1` because the column is a `smallint` in Postgres. ## Testing - New feature tests: drafts are hidden from the front page and `/blog`; a draft shows the notice, title prefix and noindex tag; a published article shows none of them. - `sail test`: 384 passed. - `npm run build` (lint + CSS/JS build + compression) is clean; the rebuilt assets in `public/assets/css` are included. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Add an Article::published() scope and use it on the front page (which
previously showed drafts), the /blog listing and the feeds. Draft
articles are still reachable at their URL, but now show a draft notice,
a "[Draft]" title prefix and a noindex robots meta tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonny merged commit a31c218784 into develop 2026-09-26 17:29:30 +02:00
jonny deleted branch draft_posts_page_tweak 2026-09-26 17:29:30 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jonny/jonnybarnes.uk!140
No description provided.