How to get styling for Ghost (Headless CMS) Blog post while fetching data using Content API from next.js

100 views Asked by At

I am using next.js to create frontend for my blog website and I am using ghost as headless CMS. I am able to fetch html for blog post using CONTENT API but it does not return styling associated with the page.

export const api: GhostAPI = new GhostContentAPI({
  url: process.env.URL,
  key: process.env.CONTENT_KEY,
  version: "v5.0",
});

export async function getSinglePost(postSlug: string) {
  return await api.posts
    .read(
      {
        slug: postSlug,
      },
      { include: ["tags", "authors"] }
    )
    .catch((error: Error) => {
      console.log(error);
    });
} 

Above returns HTML body without any css.

How can I get the styling so that in next.js, I can directly render the styled html content returned by Ghost? If this is not possible then please suggest right way to style the posts.

0

There are 0 answers