Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is difference between strapi content type and component?

I'm new user of strapi. While reading docs I got confused between content type and component.What is the difference between these two?

like image 406
Tushar Manohar Avatar asked Dec 27 '19 05:12

Tushar Manohar


2 Answers

A Content Type is a data structure that is used as a collection of specific content.

Could be Articles, Restaurants, Products, etc...

A Component is a data structure (also) that could be used and re-used in many different Content Type.

Example if you have Article and Product Content Types in your app, and you want to manage SEO tags for both of these Content Types you will create a SEO Component and use it in your Article AND Product Content Type

You will not have to create the same SEO data structure in both Content Types.

like image 172
Jim LAURIE Avatar answered Sep 24 '22 00:09

Jim LAURIE


Alternatively you can say that a Content Type is a model and a Component is a custom / composite field of one or more models.

Examples for content types could be:

  • Restaurant
  • Article
  • Product

Examples for components could be:

  • Opening hours (e.g. of a restaurant)
  • Meta tags (e.g. of articles or products)
like image 20
malliaridis Avatar answered Sep 27 '22 00:09

malliaridis