Styling Folder Template in Content Tree – Sitecore

Creating a visual reference for Sitecore items is important for content authors as well as developers. The recommended practice (or I would say mandatory) for creating an template is to assign a distinguishable icon for easier visual reference.

If you know this trick, you can go one step further to add simple CSS style on how items appear in the content tree by using the magic of the tree node style option. The most common usage for this is styling folder templates.

As you can see, the template folder under FrontEndTest called Components is italicised with lighter font colour. Along with the folder icon, it makes the item created from folder template feel like a folder, not a real item with data.

This post will be short and sweet. Let’s get started.

First, we create a folder template called components, assign folder icon and create standard values.

Then, go to Configure tab and click Tree node style. In there, you can add extra style. Check preview to see how it looks. If you are happy, click OK.

After refreshing the page, you will see the _Standard Values is styled.

When you create a component from this template, it will carry the style and looks like the one the first screenshot.

That’s it.

Front-End
TypeScript: type aliases to check type equality

This post is to analyse how the type equality check by using type aliases proposed by Matt Pocock in his twitter post. These type aliases allow us to elegantly express type equality checks in unit tests. All we need to do is to pass the output and expected types in …

Front-End
Fixing it.only type error in Jest

If you are getting a type error with it.only in Jest, it could be due to incorrect TypeScript typings or incompatible versions of Jest and TypeScript. To resolve this issue, you can try the following steps: Make sure you have the latest versions of Jest and its TypeScript typings installed …

Front-End
yup conditional validation example

Here’s an example of a Yup validation logic where the first input field is optional but, if filled, it must contain only alphabetic characters, and the second input field is required: import * as Yup from “yup”; const validationSchema = Yup.object().shape({ firstField: Yup.string().matches(/^[A-Za-z]*$/, { message: “First field must contain only …