Contentful

Contentful is a powerful headless CMS that lets you easily author and manage content for your site.

When using Contentful with toddle you get the best of both worlds. A powerful website editor that lets you build any site you want and an easy to use but flexible CMS platform for authoring content.

Watch how to set up Contentful

Setting up Contentful

Lets start by creating new content model.

Click "Content model", then "Add content type".
Give your new content type a name and a description.

Now add some fields to your new content model.
For this example we are going to add two text fields: "Title" and "Subtitle".

Click "Add field" then choose "Text" and fill in the name "title". 
Then repeat for subtitle.

Then make sure to save your changes.

Click "Save" to save your content model

Great job 🎉

Now that we have created a content model that describes what form our content should have, we are ready to add an entry.

Click on "Content" and then "Add entry"
Choose "Landing page" from the list

Fill out the Title and Subtitle for your landing page.

Fill out the "Title" and "Subtitle" fields

Then click publish!

Click "Publish"

All done! We are now ready to create our content site in toddle 🥳

Making your toddle site fetch content from Contentful

Lets create a new project in toddle based on the blank template.

Click "New project" and the select the "Website template"

Give your project a name and click "Create"

New lets wire our application up to use the Title and Subtitle we defined in contentful.
To do that, we need to create a new API, but first we need to know the URL were we can find our content.

Go to
Contentful API docs And copy the url for fetching a single entry

Click "Entry" in the left panel and then "Get single entry"
Then copy the URL from the example

Now go back to toddle and create a new API

Click the "+" button next to APIs
The give the API a name and paste the url from contentfil into the URL input.

Toddle will automatically parse the URL into its relevant parts. The URL we copied from Contentful includes some placeholders that we need to replace with real values.

You can find the "space_id" as part of the url in contentful.

Copy the space_id from the url in contentful

The entry_id under the info tab on the content page.

Copy the entry_id from the info panel on the content entry page.



The environment is called "master"

Change the environment_id to "master"

Finally you need add an access_token in form of an api key.

In contentful, go to Settings > API keys. Click Add API key and copy the Content Delivery API - access token

Go to Settings > API keys.
Click Add API key and copy the content delivery key.

Then paste it in the API panel in toddle instead of {access_token}.

On the right hand side of the API panel you can now see the returned data from the API.

Data returned from the contentful API

Using the API content in your toddle site

Now that we have successfully configured toddle to fetch data from contentful, we need to use that content inside our site.

Select the main title on the page. then click again to select the text inside the H1 element.

Then set the formula for the text node to use the title returned from the Content API.

Select the text inside the H1 element and and use the formula editor to set it to the "Title" value from contentful

Repeat for the p element and Subtitle.

Testing the setup

To test that the setup is working as intended try changing the title in contentful

Change the Title field in contentful

And refresh the toddle app to se the new content changes.

Refresh the toddle editor to see the new content changes

There are a ton of great things you can build with contentful and toddle, and we have only just scratched the surface.

If you build something cool, please share it with us in our discord server.

🥳

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code — but accessible to your entire team!

Try toddle — it's free!
Server-side rendered Installable PWAs Connect to any database As performant as code toddle is built in toddle undefined undefined undefined undefined undefined
undefined Style tokens Export as web components No feature limits Connec to any API Extend with code undefined undefined undefined undefined

© Copyright 2024 toddle. All rights reserved.