When I first found Ghost and found out about its ability to be used as a headless CMS with many popular JAMstack frameworks I got excited. But as I’ve tested, built and shipped many client projects using Ghost I have ultimately come to the same ending point, which is not using Ghost in headless and unfortunately running two sites; domain.com (NextJS) & blog.domain.com (Ghost).
The decision point ultimately comes down to two major downfalls to using Ghost as a headless CMS that makes it not worth it.
- Newsletter email template links
- Unsubscribe functions
I’ve created many sites and for any clients that didn’t want to send out blogs as emails I’ve been able to use the content/admin API to display all posts on a NextJS site.
But for me, the real game-changing feature and the thing that my clients rave about is the ability for blog posts to become a newsletter with 0 extra clicks. Trust me, when I tell you that my client’s eyes light up when I tell them they can cancel their $50+ a month email marketing tool. This killer feature in a headless setup feels all but gatekept to the Ghost native stack.
In a headless setup, the email newsletter function becomes useless and you are left to re-engineer the entire newsletter function from scratch which feels so wasteful when the Ghost team has spent a lot of time and resources figuring out how to make the email newsletter work smoothly.
Of course, you can use no code automation to send an email upon new blog posts or the Admin API with some sort of SMTP client to send an email. But again, why all this work for something that is inches away from just working right out of Ghost…
Email newsletters have hardcoded $siteUrl values that live within their template files. Secondly, the template file lives within the Node Modules of the Ghost repo which means if you do change any of these, they will get overwritten upon each upgrade. This means email newsletters in a headless CMS setup become completely useless.
I have tried:
- Editing the template (issue noted above)
- Using redirects:
sending blog.domain.com/* to domain.com/blog/*, this works for very simple cases but quickly becomes a mess of routing and is not ideal. As well I would guess is not the intended use case of the redirects function
- Using a separate Admin URL and then hardcoding the Ghost main URL to the same URL as my NextJS site. This breaks the front end but since I would be setting to private anyways I thought it didn’t matter, but then little things like the site preview, post previews and even image previews in drafts no longer work. I could live with this myself, but looks super unprofessional to client. Furthermore, is not great for vetting content before it gets posted and then parsed through the content API to my front end.
-Further to the issues with email links, the unsubscribe function is also broken, even when you have the basic redirect to 3rd party site working for blog post links.
I could see a mix of the above things I’ve tried maybe working but also proving the point of this being way to many config steps to get to a state of working
From searching through this forum and other blog posts on the topic I am only left with one option it seems, which is to rebuild the a lot of the Ghost stack/functions in my NextJS app…
I can’t be the only person who feels this is just a huge run around for no reason?
With a few small tweaks to features/settings you can, at the very least, allow for some basic headless/newsletter inter-connection to occur without the need to completely code every aspect of the Ghost feature stack over again.
- Have a true toggle for headless mode, this would:
- shut off the front end except for content and admin API endpoints + sign up / unsubscribe functions. Additionally, would keep the pages dedicated for signup and unsubscribe like a landing page, its sole purpose is to perform each of these actions.
- A function to set various URLs / redirects values for the purpose of supporting routing to an externally hosted fontend site. Again, I aware there is a redirects function but I would like this feature request as more a a Ghost specific env with some logic behind that is purpose-built to handle route to a frontend JAMstack site.
- allow for the editing of email templates, namely to configure the URLs so that they route to a fontend site
Again, I am not doubting that the above isn’t possible through countless hours of coding, refactoring, API calls, etc but feels like with a few tweaks to the core email/routing functions could be enabled for headless. This feels like something Ghost would be motivated to do seeing as the more people who chose Ghost for their project, the more chance they use the Ghost Pro hosting for their headless sites.
I would be very curious if someone has made this all work in the JAMstack world or if there are still options I am missing for self-hosting to achieve the above challenges.