Headless blog, hosted on ghost.io, custom domain in emails

I succeeded in getting a headless blog running within my NextJS site. All is well. However, when I send a post to my subscribers, it uses the ghost.io domain for the link to the post, which doesn’t have the styles I created on my site.

Current: ***.ghost.io/blog-post-title
Desired: mydomain.com/blog/blog-post-title

I can’t find anything in the ghost.io settings, and I was wondering if there’s something in the underlying config that might work. Any ideas?

Hello, and welcome to the community forum.

You may try to connect a subdomain (like blog.mydomain.com) to your Ghost Pro site, then with some redirect rules, you can redirect post links to your actual nextjs site.

This would need some careful planning though.

Ghost mentions this case in the docs as well, but point out that the newsletter unsubscribe links would break with redirects. So, a plain simple redirect for everything is not feasible.

To expand on @muratcorlu’s answer, I think there are two options here:

Stick Cloudflare or similar in front of Ghost pro, and add pagerules to redirect the traffic you want into the nextjs site. (Being careful to follow the doc @jannis wrote while I was typing this.)

Create a Ghost theme that’s basically just a bunch of javascript-based redirects. This should not break unsubscribes, etc, which are handled before the user gets to the final (theme-generated) page.

1 Like

Thanks, @jannis. I turned on Private Site mode. I never would have guessed that’s what the feature did. I’ll test for issues when I post again.

Many thanks for jumping in to help, Murat and Cathy. I’m going to avoid redirects unless and until I find that nothing else will work.

1 Like

I can confirm that Private Site mode breaks all the links in the email newsletter, so that’s not a great solution. I’m back to @Cathy_Sarisky’s suggestion of a new Ghost theme for the .io side and some redirects for posts and pages.

I’d look at modifying default.hbs to do the redirect, so you can do it in just one spot :slight_smile: