-
-
Notifications
You must be signed in to change notification settings - Fork 563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically add / for content type routes #1245
Comments
Hi there! The route needs to start a forward slash, so |
Thanks, quick as usual! Added it but it still goes to Page route. Using the latest template.
|
No, the route on the Page Type. I misread you code and thought you'd added one. The route in the controller should probably be without a forward slash. But on each page type that you need to send to a different route you have to add a [PageType(Title = "My Page")]
[PageTypeRoute(Title = "Default", Route = "/myroute")]
public MyPage : Page<MyPage>
{
} Regards |
Ah, I see. It did the trick as well, thanks!
Sent from Outlook<http://aka.ms/weboutlook>
…________________________________
From: Håkan Edling <[email protected]>
Sent: Tuesday, June 23, 2020 11:01
To: PiranhaCMS/piranha.core <[email protected]>
Cc: Magnus Karlsson <[email protected]>; Author <[email protected]>
Subject: Re: [PiranhaCMS/piranha.core] Automatically add / for content type routes (#1245)
No, the route on the Page Type. I misread you code and thought you'd added one. The route in the controller should probably be without a forward slash. But on each page type that you need to send to a different route you have to add a PageTypeRouteAttribute
[PageType(Title = "My Page")]
[PageTypeRoute(Title = "Default", Route = "/myroute")]
public MyPage : Page<MyPage>
{
}
Regards
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FPiranhaCMS%2Fpiranha.core%2Fissues%2F1245%23issuecomment-648009925&data=02%7C01%7C%7Cb5b91b6c08a146e8620508d81753fff1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637284996822308872&sdata=qJpEm4siZHNL%2F5j6GGilnyhNI4sOpFWiYIddAa2cyMU%3D&reserved=0>, or unsubscribe<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABHAYAGYFODDPV5Z67E4753RYBVOBANCNFSM4OFDCCMQ&data=02%7C01%7C%7Cb5b91b6c08a146e8620508d81753fff1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637284996822318855&sdata=r%2BizY4%2FI5m8aySudX2ZpGnpVf7N5%2FRLrtcAJxMT8Dow%3D&reserved=0>.
|
It goes to Page route in CMS controller and not the one I created (for department page). I read the route documentation and understood it like it will pick up the correct page type in the CMSCOntroller if I add the route value and Controller pagetype to the name of the pagetype?
Startup.cs
var pageTypeBuilder = new Piranha.AttributeBuilder.PageTypeBuilder(api) .AddType(typeof(Models.DepartmentPage)) .AddType(typeof(Models.StandardPage)) .AddType(typeof(Models.LanguageSelectorPage)); pageTypeBuilder.Build() .DeleteOrphans();
CMSController
`[Route("department")]
public async Task DepartmentPage(Guid id)
{
var model = await _api.Pages.GetByIdAsync(id);
DepartmentPage.cs (actually empty...)
`[PageType(Title = "Department page")]
public class DepartmentPage : Page
{
///
/// Gets/sets the available populareCategories
///
//public IEnumerable PopulareCategories { get; set; } = new List();
Then I have a DepartmentPage.cshtml in VIews/CMS..
Also, regarding the routing logic its hard to understand how I can create a english page and a Swedish page and use the same route?
The text was updated successfully, but these errors were encountered: