Skip to content

Send /newsletter to the on-site signup modal - #491

Merged
simonhamp merged 1 commit into
mainfrom
newsletter-route-redirect
Sep 1, 2026
Merged

Send /newsletter to the on-site signup modal#491
simonhamp merged 1 commit into
mainfrom
newsletter-route-redirect

Conversation

@simonhamp

Copy link
Copy Markdown
Member

What

/newsletter used to redirect straight out to the Mailcoach hosted signup page. It now redirects to the homepage with ?newsletter=1, and the newsletter modal opens itself when that query string is present.

Why

The shortlink was the one newsletter entry point that still pushed people off the site onto Mailcoach's own page, bypassing the branded modal added in #490. Keeping people on nativephp.com means they get the same "Get 10% off" framing, and signups land on our own newsletter.* confirmation pages.

How

  • routes/web.phpRoute::redirect('newsletter', '/?newsletter=1') (302, as before).
  • resources/views/components/newsletter-modal.blade.php — the open logic moved into a show() method so the open-newsletter-modal window event and the URL trigger share one path. x-init="show()" is rendered only when the request carries ?newsletter.

Because the modal lives in the layout, ?newsletter opens it on any page, not just the homepage. request()->has() is forgiving, so ?newsletter, ?newsletter=1 and anything else all work.

Testing

Three tests added to tests/Feature/NewsletterSignupTest.php covering the redirect target, the modal opening with the query string, and it staying closed without one. All 12 tests in the file pass.

Verified against the live site over HTTP: /newsletter302 https://…/?newsletter=1, and x-init="show()" renders only with the query string. The browser console shows no Alpine errors. I could not get a screenshot of the modal painted open — the preview screenshot tooling returned no image data in this session — so a quick visual check before merging is worthwhile.

🤖 Generated with Claude Code

/newsletter sent people off to the Mailcoach hosted page. It now redirects
to the homepage with ?newsletter=1, and the modal opens itself when that
query string is present.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@simonhamp
simonhamp marked this pull request as ready for review September 1, 2026 16:54
@simonhamp
simonhamp merged commit 27e26ed into main Sep 1, 2026
3 checks passed
@simonhamp
simonhamp deleted the newsletter-route-redirect branch September 1, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant