Change default value

Martin Opletal asked on March 25, 2020 10:54

Hello,

I need change default value of Page > URLs > Use custom URL path. How I can change it, if possible.

Thanks Martin

Correct Answer

Juraj Ondrus answered on March 26, 2020 08:36

When you set the "Use name path for URL path" setting then the value is automatically pre-populated for the newly created pages after the setting changed. Is this what you are looking for? Your need description is very brief and vague.
Or, do not use that setting and new pages will not have any value. But, if you want to add some custom value there automatically, then use the approach mentioned above, by Dmitry.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Dmitry Bastron answered on March 25, 2020 16:14

Hi Martin,

Could you please clarify, what do you mean by "default value of custom URL path"? When you create a new page do you want to check it and pre-populate by default? Or do you want to change the value for existing pages? Or do you want if admin ticks this checkbox the value was pre-populated instead of empty?

What is the main problem to solve? Why do you need it? Potentially, there are other ways to do it.

0 votesVote for this answer Mark as a Correct answer

Martin Opletal answered on March 25, 2020 16:37

Hi Dmitry,

I want to have pre-populate by default for new pages. It is requirement of customer.

Thanks Martin

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on March 25, 2020 16:48

You can use On Before Insert or On Before Insert New Culture (depending on your website) Kentico global document event and in this event handler set property:

private void Document_Insert_Before(object sender, DocumentEventArgs e)
{
    e.Node.DocumentUrlPath = "/your/URL/path";
}
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.