-
ABP Framework version: v9.0.5
-
UI Type: MVC
-
Database System: EF Core (SQL Server)
-
Tiered (for MVC) or Auth Server Separated (for Angular): no
Hello, I've been wondering about one feature I would like to implement.
I have some pages like
www.mydomain.com/Books
www.mydomain.com/Authors
www.mydomain.com/Magazines
but I would like to group some of them like
www.mydomain.com/CustomModule/Books
www.mydomain.com/CustomModules/Magazines
www.mydomain.com/Configuration/Authors
I am using ABP Studio to generate my sites so I don't want to modify the folder because it will break the url of the scripts generated (principal issue)
Is there a way to handle this task?
Thanks
1 Answer(s)
-
0
Hi,
You can manually map your physical .cshtml files to custom paths. Here is an example how it's done in CMS Kit:
https://github.com/abpframework/abp/blob/a753ed676687f44949cc013fd17e75b0f4c54ddb/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs#L113-L128If you need more dynamic and determined at the runtime you can go with DynamicRouteTransformer, and here how it can be implemented:
https://github.com/abpframework/abp/blob/dev/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKitPageRouteValueTransformer.cs#L46
And registration: https://github.com/abpframework/abp/blob/a753ed676687f44949cc013fd17e75b0f4c54ddb/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPagesConfigurationExtensions.cs#L29C38-L29C69But you wont need the dynamic one, probably manually mapping in the Host project would be enough in your case:
options.Conventions.AddPageRoute("/Books/Index", "/CustomModule/Books); options.Conventions.AddPageRoute("/Authors/Index", "/CustomModule/Authors); // ...