Issues with URL Alias in "Page Builder Type" pages in Kentico 12 MVC

Geo Neeliyara asked on March 11, 2020 17:07

I created landing (page builder type) pages with URL Pattern as "/LandingPage/{%NodeAlias%}. Our CMS users always looking to create a page with the type of “Page Builder Type”. So that users can create a page with the layout of their own wish and drag & drop the widget they want to the page. Right now we have an issue when we create a page with same names in sub folder levels, it treats the both page as same instance. To correct this we need update the URL Pattern to "/LandingPage/{%NodeGUID%}". Due to SEO purpose we dont want to use this logic. Does anyone have any solutions for this issue? any help will be appreciated. If you need more details please let me know as well.

Correct Answer

Dmitry Bastron answered on March 12, 2020 19:16

What you need to do is to create a wildcard URL route

var route = routes.MapRoute(
    name: "NodeAliasPath",
    url: "{*url}",
    defaults: new { culture = defaultCulture.Name },
    constraints: new { url = new PageFoundConstraint() }
);

And in the PageFoundConstraint you need to find your page by the url. You can look at the implementation of dynamic routing modules I mentioned above, it should give you a good start.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Dmitry Bastron answered on March 11, 2020 19:25

Hi Geo,

Try using %NodeAliasPath% instead as a pattern, it is always unique. Alternatively, you can have a look at a couple of URL routing modules. For example, Dynamic Routing by Trevor Fayas and Sean Wright.

Or my dynamic routing module. But it has some problems, i.e. it doesn't work well with workflow.

And just to give you heads up, next Kentico version will contain dynamic routing out of the box, you can try it in beta version.

1 votesVote for this answer Mark as a Correct answer

Geo Neeliyara answered on March 12, 2020 11:50

Hi Dmitry,

Many Thanks for the updates.. NodeAliasPath this is what i am actually looking for. URL works fine as expectecd. But the page shows 404 Error. How can I configure the route config to match the NodeAliasPath. To configure do I need to setup Dynamic Routing on my project.

Regards, Geo

0 votesVote for this answer Mark as a Correct answer

Geo Neeliyara answered on March 23, 2020 11:10

Hi Dmitry,

I tried to include dynamic routing on my project. But i couldn't succeed on this. Do you have any runtime example for this? Or Would you be able to show example on DancingGoat MVC especially in Landing Page section. I am actually confused with steps 3 & 4 under the heading "Installing on the MVC Site" Dynamic Routing

Regards, Geo

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on March 23, 2020 11:17

Hi Geo,

Could you please contact Trevor (who is the author of this package)? I'd suggest ask a question / raise an issue on Github. He is very responsive and helpful.

0 votesVote for this answer Mark as a Correct answer

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