Skip to content

Commit a3341b2

Browse files
Copilotbobbyiliev
andcommitted
Switch newsletter forms from Mailchimp to Brevo (static HTML form approach)
Co-authored-by: bobbyiliev <21223421+bobbyiliev@users.noreply.github.com>
1 parent f1d851d commit a3341b2

File tree

5 files changed

+32
-43
lines changed

5 files changed

+32
-43
lines changed

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ WATCHPACK_POLLING=true
1717

1818
# Optional: API Keys (if needed)
1919
# OPENAI_API_KEY=your_api_key_here
20+
21+
# Brevo (newsletter) — set to your Brevo subscription form URL
22+
# e.g. https://sibforms.com/serve/MUIFAAAA...
23+
# NEXT_PUBLIC_BREVO_FORM_URL=https://sibforms.com/serve/YOUR_FORM_ID_HERE

app/books/devops-survival-guide/client-content.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ export function ClientContent() {
525525
<div className="max-w-md mx-auto">
526526
<div className="p-8 bg-linear-to-br from-primary/5 to-purple-500/5 border-2 border-primary/20 rounded-2xl shadow-2xl backdrop-blur-sm">
527527
<form
528-
action="https://devops-daily.us2.list-manage.com/subscribe/post?u=d1128776b290ad8d08c02094f&amp;id=fd76a4e93f&amp;f_id=0022c6e1f0"
528+
action={process.env.NEXT_PUBLIC_BREVO_FORM_URL ?? '#'}
529529
method="post"
530530
target="_blank"
531531
noValidate
@@ -534,25 +534,19 @@ export function ClientContent() {
534534
<input
535535
type="email"
536536
name="EMAIL"
537-
id="mce-EMAIL-final"
538537
required
539538
placeholder="your@email.com"
540539
className="w-full px-5 py-4 border-2 border-border/50 bg-background/50 backdrop-blur-sm rounded-xl text-base focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary transition-all duration-300"
541540
/>
542541

543-
{/* Honeypot bot field */}
542+
{/* Brevo bot-protection fields */}
544543
<div style={{ position: 'absolute', left: '-5000px' }} aria-hidden="true">
545-
<input
546-
type="text"
547-
name="b_d1128776b290ad8d08c02094f_fd76a4e93f"
548-
tabIndex={-1}
549-
defaultValue=""
550-
/>
544+
<input type="text" name="email_address_check" defaultValue="" tabIndex={-1} />
545+
<input type="hidden" name="locale" value="en" />
551546
</div>
552547

553548
<button
554549
type="submit"
555-
name="subscribe"
556550
className="group inline-flex items-center justify-center w-full px-6 py-4 bg-linear-to-r from-blue-600 to-purple-600 text-white rounded-xl text-lg font-bold hover:from-blue-700 hover:to-purple-700 transition-all duration-300 shadow-2xl hover:shadow-blue-500/50 hover:scale-105"
557551
>
558552
<Mail className="mr-2 h-5 w-5" />

components/book-promotion-popup.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,14 @@ export function BookPromotionPopup() {
6060
}, 300)
6161
}
6262

63-
const handleSubscribe = (e: React.FormEvent) => {
63+
const handleSubscribe = (e: React.FormEvent<HTMLFormElement>) => {
6464
e.preventDefault()
6565

6666
if (!email) return
6767

68-
// Submit to Mailchimp
69-
const form = e.target as HTMLFormElement
70-
const formData = new FormData(form)
71-
72-
// Open in new window (Mailchimp requirement)
73-
const mailchimpUrl = 'https://devops-daily.us2.list-manage.com/subscribe/post?u=d1128776b290ad8d08c02094f&id=fd76a4e93f&f_id=0022c6e1f0'
74-
const params = new URLSearchParams(formData as any).toString()
75-
window.open(`${mailchimpUrl}&${params}`, '_blank')
68+
// Submit form to Brevo in a new tab
69+
const form = e.currentTarget
70+
form.submit()
7671

7772
// Show thank you message
7873
setShowThankYou(true)
@@ -160,21 +155,27 @@ export function BookPromotionPopup() {
160155
Subscribe for exclusive content & launch updates!
161156
</p>
162157

163-
<form onSubmit={handleSubscribe} className="space-y-2">
158+
<form
159+
onSubmit={handleSubscribe}
160+
action={process.env.NEXT_PUBLIC_BREVO_FORM_URL ?? '#'}
161+
method="post"
162+
target="_blank"
163+
className="space-y-2"
164+
>
164165
<input
165166
type="email"
166167
name="EMAIL"
167-
id="mce-EMAIL"
168168
value={email}
169169
onChange={(e) => setEmail(e.target.value)}
170170
placeholder="your@email.com"
171171
required
172172
className="w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-all"
173173
/>
174174

175-
{/* Honeypot */}
175+
{/* Brevo bot-protection fields */}
176176
<div style={{ position: 'absolute', left: '-5000px' }} aria-hidden="true">
177-
<input type="text" name="b_d1128776b290ad8d08c02094f_fd76a4e93f" tabIndex={-1} defaultValue="" />
177+
<input type="text" name="email_address_check" defaultValue="" tabIndex={-1} />
178+
<input type="hidden" name="locale" value="en" />
178179
</div>
179180

180181
<Button

components/footer/newsletter-form.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Mail, ArrowRight } from 'lucide-react';
22

33
export function NewsletterForm() {
4+
const brevoFormUrl = process.env.NEXT_PUBLIC_BREVO_FORM_URL ?? '#';
5+
46
return (
57
<div className="p-6 bg-linear-to-br from-primary/5 to-purple-500/5 border border-primary/20 rounded-2xl shadow-lg">
68
<div className="flex items-center gap-2 mb-3">
@@ -11,7 +13,7 @@ export function NewsletterForm() {
1113
Get the latest DevOps insights delivered to your inbox weekly.
1214
</p>
1315
<form
14-
action="https://devops-daily.us2.list-manage.com/subscribe/post?u=d1128776b290ad8d08c02094f&amp;id=fd76a4e93f&amp;f_id=0022c6e1f0"
16+
action={brevoFormUrl}
1517
method="post"
1618
target="_blank"
1719
noValidate
@@ -20,25 +22,19 @@ export function NewsletterForm() {
2022
<input
2123
type="email"
2224
name="EMAIL"
23-
id="mce-EMAIL"
2425
required
2526
placeholder="your@email.com"
2627
className="w-full px-4 py-3 border border-border/50 bg-background/50 backdrop-blur-sm rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary transition-all duration-300"
2728
/>
2829

29-
{/* Honeypot bot field */}
30+
{/* Brevo bot-protection fields */}
3031
<div style={{ position: 'absolute', left: '-5000px' }} aria-hidden="true">
31-
<input
32-
type="text"
33-
name="b_d1128776b290ad8d08c02094f_fd76a4e93f"
34-
tabIndex={-1}
35-
defaultValue=""
36-
/>
32+
<input type="text" name="email_address_check" defaultValue="" tabIndex={-1} />
33+
<input type="hidden" name="locale" value="en" />
3734
</div>
3835

3936
<button
4037
type="submit"
41-
name="subscribe"
4238
className="group inline-flex items-center justify-center w-full px-4 py-3 bg-linear-to-r from-primary to-purple-600 text-white rounded-xl text-sm font-bold hover:from-primary/90 hover:to-purple-600/90 transition-all duration-300 shadow-lg hover:shadow-xl hover:scale-105"
4339
>
4440
Subscribe Now

components/sponsor-sidebar.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export function SponsorSidebar({ className, relatedPosts = [] }: SponsorSidebarP
9898
Get the latest DevOps tips and tutorials delivered to your inbox.
9999
</p>
100100
<form
101-
action="https://devops-daily.us2.list-manage.com/subscribe/post?u=d1128776b290ad8d08c02094f&amp;id=fd76a4e93f&amp;f_id=0022c6e1f0"
101+
action={process.env.NEXT_PUBLIC_BREVO_FORM_URL ?? '#'}
102102
method="post"
103103
target="_blank"
104104
noValidate
@@ -107,25 +107,19 @@ export function SponsorSidebar({ className, relatedPosts = [] }: SponsorSidebarP
107107
<input
108108
type="email"
109109
name="EMAIL"
110-
id="mce-EMAIL"
111110
required
112111
placeholder="you@example.com"
113112
className="w-full px-3 py-2 border border-border bg-background rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary"
114113
/>
115114

116-
{/* Honeypot bot field */}
115+
{/* Brevo bot-protection fields */}
117116
<div style={{ position: 'absolute', left: '-5000px' }} aria-hidden="true">
118-
<input
119-
type="text"
120-
name="b_d1128776b290ad8d08c02094f_fd76a4e93f"
121-
tabIndex={-1}
122-
defaultValue=""
123-
/>
117+
<input type="text" name="email_address_check" defaultValue="" tabIndex={-1} />
118+
<input type="hidden" name="locale" value="en" />
124119
</div>
125120

126121
<button
127122
type="submit"
128-
name="subscribe"
129123
className="inline-flex items-center justify-center w-full px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:bg-primary/90 transition-colors"
130124
>
131125
Subscribe to Newsletter

0 commit comments

Comments
 (0)