user5016754
user5016754

Reputation:

Sitecore item DisplayName is valid used as a page title

We are working on Sitecore application. There is our vendor team is using sitecore item DisplayName as a page title. As per my knowledge this is wrong approach. But i need your help please give me a strong reason i can prove this approach is wrong.

If this is right way then please suggest that also. Thanks in advance.

enter image description here

Upvotes: 0

Views: 922

Answers (3)

Snapper
Snapper

Reputation: 686

I agree that there is nothing wrong technically but I don't think its the correct approach.

Display Name field is for all the sitecore items and I believe the mainly purpose is to show in the content editor tree.

I'd suggest that is a good practice that all your page templates inherit from base templates/interfaces where you have the page related fields like Page Title, Navigation Link Title etc.

Upvotes: 0

Jay S
Jay S

Reputation: 7994

There is nothing inherently 'wrong' in using the Display Name of an item for a page title. As @Piotr Wicijowski mentions, it is better than using the item name. The Display Name can also be used for different languages, unlike the item name.

However, there are a few issues (in addition to Piotr's post) with using Display Name as the page title:

  1. No personalization. A separate datasource would be needed on the component in order to support personalization of the page title. It is very uncommon to personalize the page title, however, so this is not a big issue.
  2. Impacts Content Editor. The Content Editor interface will show the display name in the hierarchy of the content tree. This can be helpful that the user will see a page title in the content tree, but sometimes page titles can be quite long and you may want a shorter name in the content tree.
  3. Impacts Multilingual URLs. In order to support different URLs in different languages, I have always enabled the links to be generated using display name and then provide the proper link value in the display name. A link is not always the text you want to display as the page title.

On the flip side, there are some benefits to using the Display Name:

  • Easy for content editors to find (ribbon button already there in content editor)
  • Shows up in the Content Editor for easy seeing of page titles
  • No template customization of Sitecore required to add new fields
  • Less code required to model custom fields

Upvotes: 1

Piotr Wicijowski
Piotr Wicijowski

Reputation: 2115

As opposed to using item Name (which has a lot of restrictions, like disallowed characters and not being able to have different values per language), using DisplayName for page title can, in fact, be a good choice, for the following reasons:

  1. It can be any UTF8 string, which helps with internationalization of the site
  2. It can have different values per language.
  3. DisplayName can be used for url->item resolutions, which would result in having your title as a part of the url. This is beneficial both for SEO and for user-friendliness of your urls.

The only possible downside is the fact that DisplayName field is unversioned, which means that you won't be able to have different values per item version.

Upvotes: 0

Related Questions