I’m doing a test to use Ghost as a headless blog post CMS, but the content returned by the API doesn’t have the CSS and JS links to render the page perfectly. What the best way to do this?
The idea of using Ghost in a headless setup is exactly that. You get the content through the content API and then do what you want on the other side.
That includes styling and adding functionality. Ghost’s job in this is really just to deliver the actual content.
What’s your goal with this setup? If you share more, we might be able to point you in the right direction.
Got it @jannis . My goal is using a third-part application (blog or CMS) headless to avoid create a new one inside my website. My website has a blog, but it is very simple. I need to give to the content creators more tools, so ghost has everything I need in the post creation, but when I “embed” the content in my website, I’d like to get the same visual of the post from Ghost. For content creators will be easy in this way. And SEO also is important, that I got them by JS library.
I did some other try outs here importing some CSS and JS. Was better, but I guess if we could have a embed API call, could be better.
I understand that we can have some CSS conflicts, but is better solve conflict that try to find out all CSS and JS I need to import to show the post as on Ghost.
Hm, what you’re asking for here is not really compatible with the way Ghost works.
The headless approach is really meant for cases where you want complete control over the presentation layer, with Ghost purely managing the content. If maintaining Ghost’s exact styling is crucial for your workflow, a headless setup might not be the best choice for your specific use case.
Maybe a subdirectory installation of Ghost could work? But the styles will differ, of course, unless you rebuild your site as a Ghost theme.
(These are instructions for Ghost(Pro), but the idea applies to most Ghost installations)
Thank you @jannis. I think you are right, maybe a subdirectory can be a good way. I will try to import the basic CSS and other things to be close of the view from Ghost. Because the main thing is allow the content creator uses all the tools that are in Ghost. Probably I will try to improve this way I did before move to a subdirectory.