Defining blog classes
As we said, a blog is made up of articles and categories, so the first step we need to do is to create two classes relating to these. In addition to these two classes, we have to create a third class: BlogAuthor
.
All the field types that we are going to use in our classes have already been seen and described in depth in Chapter 5, Exploring Objects and Classes, so what interests us in this chapter is to define them with their name and type.
The only new element we use is the slug
field, which for this reason we will briefly describe.
A slug is a part of a Uniform Resource Locator (URL) that identifies a particular page on a website in an easy-to-read way. In other words, it's a part of a URL that explains a page's content—for example, for a URL of https://demo.pimcore.fun/slug, the slug simply is /slug
.
Using a slug thus allows us to identify a page through a readable and more identifiable text, compared—for example—...