how can i add and access multiple documents( same page type ) under the root ?

Muhammad Kaleem asked on May 17, 2019 12:19

i have created a page type and in general setting i give url pattern as "{%NodeAlias%}" i want to add multiple documents under the root of same type, so that whenever i add a new document its url will be according to its name, please suggest any help will be highly appreciated

thanks

Recent Answers


David te Kloese answered on May 17, 2019 16:12

Since you tagged it as routing issue I assume thats the issue.

You should add a wildcard rout:

route = routes.MapRoute(
         name: "SomeRouteName",
         url: "{*nodeAlias}",
         defaults: new { culture = defaultCulture.Name, controller = "yourController", action = "ActionName"},
         constraints: new { culture = new SiteCultureConstraint()}
        );

And in your controller or data retrieval code you need to get the page based on node alias.

Keep in mind you might need some logic to make NodeAlias unique in the CMS, as Kentico by default only restricts this by PageType for MVC sites.

0 votesVote for this answer Mark as a Correct answer

Muhammad Kaleem answered on May 21, 2019 17:21

thanks David,

i have try this solution but this conflicts with default route, please suggest thanks

0 votesVote for this answer Mark as a Correct answer

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