How do I create a thank you page after confirming subscription on email

Hey guys,

I’m using a customized theme on top of Casper. I want to introduce a custom thank you page after the user has confirmed the subscription from email.

Right now it shows a green notification bar at the top when they’re directed back to the website.

Why I want this:

  • Sometimes the emails get caught by the spam filter, I want to display a message on the thank you page to add us contacts so that it doesn’t get lost in spam

Any ideas on how to implement this without messing with the ghost core?

Hey @shavin47 :wave:
You can build upon that notification bar functionality and redirect successfully subscribed members. Check out the following code in Casper:

By replacing the addClass line like so:

if (action == 'subscribe') {
    window.location.href = '{{@site.url}}/thankyou/';

You can redirect people to a custom made thank you page. After you’ve added this code you’ll need to create a page with the slug thankyou and add the thank you message you want.

Hope this helps :blush:

1 Like

Hey @DavidDarnes,

Yep! I think this will work, I’ll try it out and mark it as a solution.

Thanks a lot!

1 Like

I tried it out @DavidDarnes

There’s a small lag time between the home page and for the redirect to kick in but it’ll do for now.

Also, I had to add in window.location**.href** into your code for it to work (just saying if incase someone wants to refer this in the future)

Sorry where how exactly do you mean window.location**.href** ? I’m trying to make this work also, I would be so grateful if you care to explain one more time?

Should be your default.hbs file. If you’re using Casper. Line 108.

He meant adding href like so in your default.hbs:

if (action == 'subscribe') {
    window.location.href = '{{@site.url}}/thankyou/';

Oops, thanks. Fixed the typo. If you’re seeing a lag then it’s most likely other code on the page blocking it from loading such as larger JavaScript libraries

1 Like