-
Hi, A newbie question here 😊 I'm working on a custom theme for my OrchardCore demo. I started with the "Blank recipe" for a clean setup. Next, I created a custom theme following this guide and added the reference to the Web App project. I didn't create a module as explained here because I only needed a custom theme, and it wasn't mentioned as mandatory step. I added a What I'm supposed to do is create a Razor view named
I've looked through the Themes guide and the Templates guide, but I'm still confused 🤯 Thanks for any help |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Your view should be displayed if it's served by a controller otherwise, you could place it inside the |
Beta Was this translation helpful? Give feedback.
-
You can if your controller will provide a https://docs.orchardcore.net/en/latest/docs/reference/modules/Contents/#razor-helper |
Beta Was this translation helpful? Give feedback.
-
The issue with the controller not being hit was due to a missing mapping in the public class Startup : StartupBase
{
public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
{
routes.MapAreaControllerRoute(
name: "MySite.Home.Index", // Choose a name for this route
areaName: "MySite.OrchardCore", // Insert your theme project path
pattern: "/", // In this way, the Home controller > Index Action, is hit when visiting the base URL
defaults: new { controller = "Home", action = "Index" }
);
}
public override void ConfigureServices(IServiceCollection services)
{
}
} Regarding model mapping, as @hishamco commented here, Orchard Core always creates Content Types dynamically. If you need a model, you can create a Thank you |
Beta Was this translation helpful? Give feedback.
The issue with the controller not being hit was due to a missing mapping in the
Startup.cs
file of my theme project. The automatic Orchard template doesn't generate a Startup file by default, so I added one myself. Inspired by theOrchardCore.Demo
module, which you can see here, I included the following route mapping, and it resolved the issue: