Kontent by Kentico: Creating Content Types

Akshay Sura - Partner

13 Jan 2022

In this video, we walk through how you can create content types in the Kontent Headless CMS.

Transcript

Note: The following is the transcription of the video produced by an automated transcription system. 

Hi, this is Akshay Sura from Konabos. Today, we will look at creating new content types, so in our sample application, as you can see, we have a coffee store and we have quite a few things which are going on in terms of articles and we have coffee cafes and all of that fun stuff. So let's try to look at how might something like a press release look like. So, let's create a new content type. Let's call it press release, and then we need quite some attributes. Let's start with a couple of attributes. So, as you can see on the right side, we have a few content elements we can create. So, for instance, here you could call title over here. In terms of the settings, you can make this required. You can limit the number of characters if you like. If you would like to go a step further, you could have regular expressions, which you know, if you are aware of it, you can restrict the format of this field. So, for instance, think about an email field or a phone number where you would like it to be in a specific format. You could specify the regex for it, and it will restrict the input in the same way every single time. It's a good habit to give some guidelines in terms of how exactly or what the purpose of this field is for.

There's also the guidelines field over here, so if you can, you could specify the guidelines in terms of. This press release and any other info you would like to specify, according to the guidelines of your company. You could definitely do so. Same thing with the field. You can specify some helpful text. And that would suffice at this moment in time. You could also add other fields, so for instance, the rich text field, you want some content you probably want to make it required. You could also get into it and specify what they can and can't use. So, if you have some pieces of content where you don't want them to use subscript, superscript or links inside of them, you could do that could restrict them in terms of tables. Images like anything else, if they can't embed components. So, if you have components or other items, you could embed them in your rich text. And if you want to restrict that, you could do so again, specify a guideline. There's different types of elements, so you could have a number, multiple choice daytime assets if you're storing assets inside of content. If you're using an external system like binder or Cloudinary, you might want to end up using a custom element.

We'll get into that sometime later. You could have linked elements. And what I mean by that at this moment in time, we want to by line who's the author, for instance, or the contact for this press release. But we could either specify the contact as different fields so we could drop fields into, say, what's the contact, first name, last name, email, phone number? But then every time you would do the press release, create a new press release, you would have to specify those again, and the information is not as reusable. What would be nice is if we had another, another content, type of type contacts or authors, for instance. And then what you could do at that moment in time is in here. We could have a linked item and then just link to that contact. So for instance, if the person's email address or phone changes, you don't have to go back to every single press release to modify that because it's a linked item, it's easier. So you could use quite a few of this content elements in order to define what your content type is. So in this case, I did that. You can add taxonomy items and we will look at what taxonomies are. You could add an URL slug, which wouldn't. For this case, it might not be beneficial because you're also like some mainly for things which are pages.

A press release could be a page, but a press release by itself is a piece of content. We want it to be independent and just define what a press release is. When we talk about the page, the page has different attributes, like What are the meta tags? What's the header? What's the footer? There's a bunch of elements which could go into a press release page. Part of it is a link to the press release item, but the rest of it is very specific to a page. So since this isn't a page, we are not going to add a URL slug and content type snippets we will obviously talk about shortly. So now I have, I'm just going to stop here and just create the press release. We probably want to go ahead and what I can do for now, just for testing purposes, we can say contact. So from a contact perspective, let's take the full name. Uh. Make it required, we can add a guidelines right here. Contacts are used. You could add other guidelines if you like. For now, I'm just going to leave it with a couple of things let's just do. Phone and email, and then let's make him required, I am not going to specify the regex at this moment for that because I'm trying to show you linked items, so I'm done with contact.

Now let's get back into press release, and what I'll do is I'll add a link to item call contact. What we want is we want it to be required. Exactly one, right? And then we need it to be of type contact. So in this case, what happens is that we created a press release and we have a linked item going to a contact. So this way we could build upon our content types quite easily. Use quite a bit of this. Custom elements give a lot of functionality. So any functionality which isn't provided by these kind of items, if you need something to pick products, you need something which can do much more as in calculate things based on values in existing items, you could build that as a custom element and drop it in. So custom elements required some work from development perspective. So you would have to host it in its own URL. You might have to pass in some information. In our case, at this moment, we don't need it, so we are not going to touch it. So that concludes our content type demo. Thank you so much for watching. I hope this was useful.

If you have any questions, please get in touch with me. @akshaysura13 on Twitter or on Slack.

Sign up to our newsletter


Tags:

Composable DXP
Headless CMS
Jamstack
Kontent

Share on social media

Akshay Sura

Akshay is an eight-time Sitecore MVP who has spent more than a decade working exclusively on Sitecore projects.

In addition to his work as a solution architect, Akshay is also one of the founders of SUGCON North America 2015, SUGCON India 2018 & 2019, Unofficial Sitecore Training, and the Sitecore Slack.

Akshay founded and continues to run the Sitecore Hackathon. As one of the managing partners of Konabos Consulting, Akshay will continue to work with clients to lead projects and mentor their existing teams.


Subscribe to newsletter