Created
July 11, 2017 16:03
-
-
Save joeaudette/85653b357a3cf508dd0c2a18332bd170 to your computer and use it in GitHub Desktop.
simplecontent not as home page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This sample come from cloudscribe.com site where I use home controller and index view for home page and have /docs as the starting point for simplecontent pages | |
My routing looks like this: | |
private void UseMvc(IApplicationBuilder app, bool useFolders) | |
{ | |
app.UseMvc(routes => | |
{ | |
if (useFolders) | |
{ | |
routes.AddBlogRoutesForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint()); | |
} | |
routes.AddBlogRoutesForSimpleContent(); | |
routes.AddSimpleContentStaticResourceRoutes(); | |
routes.AddCloudscribeFileManagerRoutes(); | |
if (useFolders) | |
{ | |
routes.MapRoute( | |
name: "foldererrorhandler", | |
template: "{sitefolder}/oops/error/{statusCode?}", | |
defaults: new { controller = "Oops", action = "Error" }, | |
constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } | |
); | |
routes.MapRoute( | |
name: "folderdefault", | |
template: "{sitefolder}/{controller}/{action}/{id?}", | |
defaults: new { controller = "Home", action = "Index" }, | |
constraints: new { name = new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint() } | |
); | |
//routes.AddDefaultPageRouteForSimpleContent(new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint()); | |
routes.AddCustomPageRouteForSimpleContent("docs", new cloudscribe.Core.Web.Components.SiteFolderRouteConstraint()); | |
} | |
routes.AddCustomPageRouteForSimpleContent("docs"); | |
routes.MapRoute( | |
name: "errorhandler", | |
template: "oops/error/{statusCode?}", | |
defaults: new { controller = "Oops", action = "Error" } | |
); | |
routes.MapRoute( | |
name: "def", | |
template: "{controller}/{action}", | |
defaults: new { controller = "Home", action = "Index" } | |
); | |
//routes.AddDefaultPageRouteForSimpleContent(); | |
}); | |
} | |
and my navigation.xml file looks like this: | |
<?xml version="1.0" encoding="utf-16"?> | |
<NavNode key="Home" | |
parentKey="RootNode" | |
controller="Home" | |
action="Index" | |
text="Home" | |
isRootNode="false" | |
> | |
<Children> | |
<NavNode key="Blog" | |
parentKey="RootNode" | |
controller="Blog" | |
action="Index" | |
text="Blog" | |
viewRoles="" | |
componentVisibility="" | |
> | |
<Children /> | |
</NavNode> | |
<NavNode key="Docs" | |
parentKey="RootNode" | |
namedRoute="" | |
text="Docs" | |
url="/docs" | |
componentVisibility="" | |
treeBuilderName="cloudscribe.SimpleContent.Services.PagesNavigationTreeBuilder" | |
treeBuilderAppendToBuilderNode="true" | |
viewRoles=""> | |
<Children /> | |
</NavNode> | |
<NavNode key="Contact" | |
parentKey="RootNode" | |
controller="Contact" | |
action="Index" | |
text="Contact" | |
viewRoles=""> | |
<Children /> | |
</NavNode> | |
.. omitted for brevity | |
</NavNode> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment