Can the child documents inherit the Custom URL path of it's parent in Kentico -
I have a situation where my client wants a SEO friendly URL for their documents and these URLs have client documents. Here's an example setup:
Route
-
Groups
-
Group 1 (custom url = / groups / Page 2
-
Group 2 (custom url = / groups / ma / boston / group 2)
- page 2
- Page 4
- etc
page 1, page 2, page 3 , Pager will have to inherit the custom URL of his parent and may be:
- / group / ma / salem / group1 / page 1
- / group / Ma / salem / group1 / page2
- / group / ma / boston / group2 / page2
- / sum
When I set up a custom URL path, it only affects that document and the child documents remain the same: P>
- / group / group 2 / page 2
- / group / group1 / page1
- / group / group1 / page2
- / group / group 2 / page 3
Can it be achieved in Kentucky without involving the url parts to modify the tree structure?
Is there a way to override the ResolveURL () function, so can I return SEO friendly URL?
I'm using Cantt 8.1.
Making those documents in the tree will certainly be the easiest and safest solution, but you want to avoid it I have two other options to see.
1) Write a rewrite rule to the URL to emulate this tree hierarchy <2 p>
2) Document before the event Insert and set custom URL path according to your needs.
The code may look something like this:
DocumentEvents.Insert.Before + = DocumentInterceptSea; Private static zero documentIntebbere (Object Sender, DocumentEventArgs E) {TreeNode node = E. Node; If (node.NodeAliasPath.StartsWith ("/ groups / group1")) {string safeNodeName = TreePathUtils.GetSafeDocumentName (node.DocumentName, CMSContext.CurrentSiteName); String custom path = "/ group / ma / salem / group 1 /" + secure node name; // Multiple Dash Custom Path = TreePath Youthil Gateusuf url path (path, cmscontentcontentSite name, true); Node.DocumentUrlPath = customPath; }}
-
Comments
Post a Comment