New Feature: Easier Content Access with Content Island api

In early July, we released an update to the Content Island API library that greatly simplifies how you access content. Until now, consuming data required more manual steps than we liked. That’s now a thing of the past!

🔧 How Did It Work Before?

To access content from Content Island, you had to:

  • Manually define the data model you wanted to consume.
  • Map the response from getContent or getContentList to your model (using a mapper provided by Content Island).

Why? Because responses include useful metadata… but for 90% of use cases, it’s not needed. So we decided to simplify the flow.

Classic Example

  1. Manually define the data model in TypeScript:
export interface About {
  id: string;
  picture: {
    name: string;
    link: string;
  };
  fullname: string;
  shortBio: string;
  extendedBio: string;
}
  1. Map the response using the provided mapper:
export async function getAbout(): Promise<About> {
  const response = await client.getContent("67c9817f98e17b1396f20d0f", {
    contentType: "About",
  });

  return mapContentToModel<About>(response);
}

🚀 What’s New in This Version?

Now everything is much easier. In the Model tab of the Content Island app, at the top of each entity, you’ll see a button with the TypeScript icon.

📋 Copy the Model Instantly

Clicking it opens a modal with the pre-generated TypeScript interface. Just copy it and use it directly in your code. That’s it.

generate-ts.gif

🧠 No More Mappers

You no longer need to manually map the response. Just pass your model as a generic to getContent or getContentList, and Content Island handles the rest.

export const getAbout = async (): Promise<About> =>
  client.getContent("67c9817f98e17b1396f20d0f", {
    contentType: "About",
  });

🛠️ Need Metadata?

No problem! If your use case requires access to metadata (like timestamps, revisions, internal IDs...), you can still use the new methods:

  • getContentRaw
  • getContentListRaw

These return the full response with all metadata, just like before.

📚 More Resources

Here are the links to the official documentation if you want to explore further: