Send /newsletter to the on-site signup modal - #491
Merged
Conversation
/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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
/newsletterused 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.php—Route::redirect('newsletter', '/?newsletter=1')(302, as before).resources/views/components/newsletter-modal.blade.php— the open logic moved into ashow()method so theopen-newsletter-modalwindow 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,
?newsletteropens it on any page, not just the homepage.request()->has()is forgiving, so?newsletter,?newsletter=1and anything else all work.Testing
Three tests added to
tests/Feature/NewsletterSignupTest.phpcovering 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:
/newsletter→302 https://…/?newsletter=1, andx-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