Content-type vs. part

What is the intended, best-practice use of a content-types, and what is the intended use of parts?

Let’s say I’d like to create a generic article template, with a title, introduction and body copy. The article does also have a field for comments, as well as a list of related articles.

Should the article setup be stored in a content-type, or should it be stored in a part? How about the comment field? How about the list of related articles?

Disclaimer: I am no expert, and don’t take this as best-practice, but I have played around with 5.x and now 6.0.0 for a while. I expect the experts will answer this soon, but this is how I have understood things so far:

  • Content-types must be used for all “pages” (like the article you are describing). They are assigned a page-template (In the template you set up, there is a “Supports”-field, where you add the content type), which is consists of parts showing content from the content type.
  • The comment-field definitely sounds like a part of it’s own. As for the title, introduction and body, that could probably be an “article-show”-part. See this page in the docs.
  • The content (title, intro and body) should at least come from the content-type, and not from the part config. The comments depends on how you want them stored. They should at least have a connection to your article, and be searchable based on the article ID. (So you can retrieve them in the part)
2 Likes

Hi Helge!

Vegard - thanks for the input.

My short version is:

  • Content types are used to produce instances of semi-structured and reusable data, that can easily be linked together like a graph. They are closely aligned with structured search capabilities and are comparable to “tables” in SQL. Content types make the job for content editors simple.
  • Parts are visual widgets that can be configured (with data), and are mainly intended for creating unstructured WYSIWYG presentations that are rarely reused. Typical use is when creating landing pages or page templates, providing the user freedom in design/composition.

To add to the confusion, we will (ETA 6.1 add a new content type “Fragments”). Fragments basically enables you to save any page component (parts, layouts, text etc) as content. You will then be able to create a part, configure it and “convert” it to a fragment (content) and re-use it across pages (drag’n drop) fragment onto page.

For your specific case, I think Vegard’s comments make sense. Article as cty, then create as many parts as you desire to provide flexibility when creating your Article page template. A general advice here is not to over-design. So 2-3 parts should be enough for your case: Article Show, Comments - and maybe a separate one for “Related articles” if your design needs it.

To add more flexibility you should consider using “layouts” too…

1 Like

This makes sense to me.

Thank you very much for your inputs, Vegard and Thomas.