Get the data from the CMS into javascript?

Hi community :wave:,

we want to access information from the CMS in javascript. Right now we are using a collection list with each item being an invisible HTML-Embed element. Inside of the HTML-Embed we are setting up a JS-Object with all of the CMS-Items properties. Unfortunately, we have a number of problems with this approach.

  1. Is there any other way to get the data from the CMS into javascript?

  2. Inside of the HTML-Embed we have no access to multi-reference fields. Is there a way to output those inside of the HTML-Embed?

  3. The Collection-List is limited to 100 items when there is no pagination. If we activate pagination, the elements are not in the DOM at the moment when we are parsing the data into javascript. Is there any way to access the data of the following pagination pages, without clicking the next button? How does Webflow load the data of the following pages when clicking next?

Thank you very much!

Hey @info4! For questions 1 and 2 it may be worth checking Webflow’s CMS API to see if they offer any info on how to achieve this.

For question #3, if you are using CMS Load and the CMS API does not give access to all items, you can get the whole list using our CMS Load API.

Here is an example

  window.fsAttributes = window.fsAttributes || [];
    (listInstances) => {
      console.log('cmsload Successfully loaded!');

      const [listInstance] = listInstances;
      const items = listInstance.items; // This stores all items in the list rendered or not

      // Execute your code here

Thank you very much and sorry for the late response! It was very helpfull and we were able to handle the other problems as well =)!

1 Like

Great to hear! :raised_hands: