Try our conversational search powered by Generative AI!

Change name of page in tree only in edit mode



We want to change the name of a page in the pagetree.


"Enkel sida" = "Simple page" - only in the sidebar editmenu should be named something else (if a special naming property is set).

I've tried to implement a portion of this

But it doesn't seem to work in EPiServer 9. Any ideas or suggestions?

May 27, 2016 11:03
    public class CustomGetChildrenQuery : GetChildrenQuery
        public CustomGetChildrenQuery(IContentQueryHelper queryHelper, IContentRepository contentRepository, LanguageSelectorFactory languageSelectorFactory)
            : base(queryHelper, contentRepository, languageSelectorFactory)

        protected override IEnumerable<IContent> GetContent(ContentQueryParameters parameters)
            return (from content in base.GetContent(parameters)
                let data = content as SitePageData
                select new Content(content, data?.NameInEditMode)).ToList();
public class Content : IContent
        public Content()

        public Content(IContent content, string nameInEditMode)
            Property = content.Property;
            Name = string.IsNullOrEmpty(nameInEditMode) ? content.Name : nameInEditMode;
            ContentLink = content.ContentLink;
            ParentLink = content.ParentLink;
            ContentGuid = content.ContentGuid;
            ContentTypeID = content.ContentTypeID;
            IsDeleted = content.IsDeleted;

        public PropertyDataCollection Property { get; }
        public string Name { get; set; }
        public ContentReference ContentLink { get; set; }
        public ContentReference ParentLink { get; set; }
        public Guid ContentGuid { get; set; }
        public int ContentTypeID { get; set; }
        public bool IsDeleted { get; set; }

If I do like this, the editmenu becomes empty.

May 27, 2016 12:29

Possible to do it the other way instead and use pagename as what you really want in edit mode and use a second property elsewhere that defaults to pagename if it isn't set. I'm guessing you are using page name somewhere on site and want shorter names in edit mode or similar?

May 27, 2016 13:35

Yes something like that. But isn't the name used as a part for the URL?

We don't want to change that behaviour.

May 27, 2016 13:40

The url part is a property of it's own you can change (doesn't have to be the page name but it defaults to page name)

It's called url segment and can be set in edit mode separately. 

If you do that on existing pages however, be sure you understand the SEO penalty for changing urls

Edited, May 27, 2016 13:46

I'll have to ask the customer if that's enough. Thanks for now :)

May 27, 2016 13:53

Changing page name after you have created page won't change url btw so you can always do that. (moving it in page tree does though...)
Let's hope it works out without custom custom page trees :)

May 27, 2016 14:04

But if I change the "Name" property, wouldn't that change the pagelink name too?

Do you have suggestions how to "Possible to do it the other way instead and use pagename as what you really want in edit mode and use a second property elsewhere that defaults to pagename if it isn't set. "?

May 30, 2016 6:46

The name of the links that is displayed to the user depends on what property you are using for links. For linkitemcollection you can set name on each link so no problem there. The url property however defaults to page name I think. I usually avoid using that one for internal links. If you use a content reference as property, you can create a new display template if you want to customize rendering. You could  have an additional property on your page called LinkName or similar and use that one for link name if set and page name if not set. 

...or tell the customer that yes it's possible but normally you use the page name in both edit and for links. :) Just because you can doesn't mean it's a good idea...

May 30, 2016 7:10


You get the empty result because the method Filter checks your collection(IEnumerable<Content>) for compliance with input parameters.

In particular the collection loses items during checking by type identifier.

In you case:


[0] = "episerver.core.pagedata"

You need to override the method Filter or add the typeIdentifier of type "Content" into the parameters.TypeIdentifiers array to fix the empty result.

If you want to add the typeIdentifier into the TypeIdentifiers array then you should

1. create a UIDescriptor class for the Content class

public class ContentEditorDescriptor : UIDescriptor<Content>
	public ContentEditorDescriptor()
		: base(ContentTypeCssClassNames.Page)

2. add the typeIdentifier into the TypeIdentifiers

var type = typeof(Content);
var typeIdentifiers = uiDescriptorRegistry.GetTypeIdentifiers(type);
var typeIdentifier = typeIdentifiers.FirstOrDefault(x => x.Contains(type.Name.ToLower()));
if (!string.IsNullOrEmpty(typeIdentifier))
parameters.TypeIdentifiers = identifiers.ToArray();

One comment

If you add these changes you will get a necessary result.

But when click on such node you will get default text(name).

You want to fix it you should create own StructureStoreModelTransform class and override the method TransformInstance

[ServiceConfiguration(typeof(IModelTransform), Lifecycle = ServiceInstanceScope.Singleton)]
public class ContentStructureStoreModelTransform : StructureStoreModelTransform

        // constructor

	public override void TransformInstance(IContent source, StructureStoreContentDataModel target, IModelTransformContext context)
		if (source is SitePageData)
			var page = source as SitePageData;
			var newSource = new Content(page, page.NameInEditMode);
			context.Source = newSource;
			base.TransformInstance(newSource, target, context);
			base.TransformInstance(source, target, context);

Best regards

Edited, Feb 17, 2017 17:36
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.