Set default name for pages

Vote:
 

I was googling and trying some code myself, but didn't find anything that would work :/

How to customize the name of the new page created in the UI:

I'd like to change New Page to something I set in the Page Type.

Tried this in SetDefaultValues():

this[MetaDataProperties.PageName] = DefaultName;
PageName = DefautlName;
Name = DefaultName;

But is seems it doesn't have any impact.

#224424
Jun 19, 2020 11:17
Vote:
 

I guess the name from the UI overrides whatever default value you provide. I'm not sure how to change the "New Page" in the UI, but it's probably stored in some resource file that you can override. See: https://blog.novacare.no/change-text-in-the-episerver-ui/

Another option is hooking into the CreatingContent event: see https://world.episerver.com/blogs/Daniel-Ovaska/Dates/2019/6/content-events-in-episerver/

private void Events_CreatingContent(object sender, EPiServer.ContentEventArgs e)
{
    if (e.Name == "New Page")
    {
        e.Content.Name = "This works!";
    }
}

Using this aproach you will see "New Page" until you click "Create". When the new page is created, you will see your overridden page name.

#224425
Edited, Jun 19, 2020 13:25
* 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.