Contentful is a great option if you need a free headless CMS that's easy to setup.
On the free plan, Contentful limits you to 25 content types. If you use those up, you need to pay 350$ per month to unlock more content types – a pretty expensive upgrade for small websites.
So before upgrading, you might want to check if you have any unused types that you could remove from your project.
You can do so using the following script:
unused-contentful-types.js
const { createClient } = require('contentful')const CONTENTFUL_ACCESS_TOKEN = '...' // Insert your access token hereconst CONTENTFUL_SPACE_ID = '...' // Insert your space ID hereconst client = createClient({space: CONTENTFUL_SPACE_ID,accessToken: CONTENTFUL_ACCESS_TOKEN,});(async () => {const contentTypes = await client.getContentTypes().then((result) => result.items)for (const contentType of contentTypes) {const entries = await client.getEntries({ content_type: contentType.sys.id }).then((result) => result.items)console.log(entries.length, 'entries:', contentType.sys.id)}})()
You can run it like this:
$ node unused-contentful-types.js0 entries: blogArticle0 entries: blogNews0 entries: blogTutorial1 entries: blogInterview1 entries: blogReview1 entries: blogGuide1 entries: blogEvent1 entries: blogPodcast2 entries: blogVideo3 entries: blogPhotostory4 entries: blogQuote5 entries: blogInfographic6 entries: blogInteractive6 entries: blogPoll7 entries: blogSlideshow8 entries: blogQuiz9 entries: blogListicle11 entries: blogRecipe12 entries: blogPersonalStory14 entries: blogAnalysis25 entries: blogOpinion30 entries: blogTravelogue32 entries: blogResearch36 entries: blogResource44 entries: blogShowcase