By Danny Paul van Iersel, 22-04-2024
Being able to fully customize a page is a huge advantage and will give your editors full control over what they want to show or highlight on a page.
When we allow editors to place any widget in any place on the page, as developers, we need to make sure that a component or widget can fit in any location.
If a widget is only created to be on a full width section of a page and will break your design once it is placed in a column that is much smaller. We need to be aware of this fact and guide or limit the use of a widget so editors can only place a supported widget on the location they want.
There are always multiple solutions to 1 problem. We either:
Why not create 1 page type to have the flexibility to support everything?
It might be useful to have 1 page type where editors can create all pages from. This can however be difficult if there is an increase of components. The list of available widgets or sections can be overwhelming.
In this case it could still be wise to separate page types to have more control over the pages in what an editor is allowed to change.
Within an editable-area we can restrict the area what widget or section is allowed. Using the area-options-allowed-widgets and the area-options-allowed-sections. As value we can have a list of strings of widgets or sections:
A better way would be to reference these string text by a constant variable. So that you do not have a typing error if you would reference the same widget on two different editable areas. Like Hero and next you type Hro.
The same thing can be done on a widget-zone. Having the property allowed-widgets set with the value list of allowed widgets.
A final way to restrict this, is to inject via dependencies into your view. This could be used for more complex functionality. For example to restrict a widget to be only used on specified channels.
This is however a very interesting feature that I will definitely be investigating and will demonstrate in later articles. For this could potentially lead to an extension with a new module in the Kentico administration. Where we can dynamically configure what widget is allowed to what area. In combination with the injection service it will then be possible to only allow widgets on the fly.
Keep in mind the last option is very complex and will need more development than the other options.
With the use of widgets it is intended to visualize you data. If you have structured your data correctly one widget could serve multiple purposes.
For example we have a teaser card widget. We want to show data of a reusable content type called article.
The article content type contains the following fields:
Our widget will show the above data as followed:
If we add additional properties to our widget. We could introduce a styling property.
This property could select the location of the image, left or right.
The output of the same widget with the same data would then show as followed:
Xperience by Kentico is a great tool and depending on your needs it is very flexible and can be custom tailored to your own wishes.
More flexibility will have an initial extra cost but in the future can provide you with a faster way of creating your content.
You will not always need new development to create new features or new components. Sometimes the components are already flexible enough to provide you with all the possibilities.
Ready to take your digital experience to the next level? Feel free to contact us to learn more about our services and how we can help you leverage the full potential of your digital marketing.
Get in touch with one of our consultants to find the perfect match that fits your needs and enables you to grow.