I have an existing site which was using a MacroPartial to generate navigation and I am now trying to add it to a new blog section.
Following the advice on the thread mentionned previously (see link) I have moved the content of my PartialViewMacro into a regular Partial view, changing the initial 'PartialViewMacroModel' for 'Umbraco.Web.Models.RenderModel', which seems required to filter descendants with LINQ.
The old part of the website seems fine with these changes but I am still getting an error with I try to get to the Articulate blog i.e.
The model item passed into the dictionary is of type 'Articulate.Models.ListModel', but this dictionary requires a model item of type 'Umbraco.Web.Models.RenderModel'.
What am I missing? Any help would be greatly appreciated
Yes I managed to find a workaround. In short I created a new Articulate theme and the root document (of the blog) starts with the following:
@model Articulate.Models.IMasterModel
@using ClientDependency.Core.Mvc
@using Articulate;
@{
var siteRoot = Model.AncestorsOrSelf().Last();
var navModel = new Umbraco.Web.Models.RenderModel(Model);
...
}
Then comes my HTML (copied from the old part of the site for a similar look) with the call to the partial with the navigation
@Html.Partial("MainNav", navModel)
The view starts with the following:
@model Umbraco.Web.Models.RenderModel
@{
//From the currentpage - get the root node (Select the node at level 1)
var rootNode = Model.Content.Site();
var selection = rootNode.Children.Where(x => x.IsVisible());
...
}
Embedding existing site navigation into new Articulate blog
Hi there
I have a similar issue as described here (see link) but this post only seems to get me part of the way hence why I am opening a new thread:
https://our.umbraco.org/projects/starter-kits/articulate/discussions/66713-umbraco-site-navigation-macro-within-template
I have an existing site which was using a MacroPartial to generate navigation and I am now trying to add it to a new blog section.
Following the advice on the thread mentionned previously (see link) I have moved the content of my PartialViewMacro into a regular Partial view, changing the initial 'PartialViewMacroModel' for 'Umbraco.Web.Models.RenderModel', which seems required to filter descendants with LINQ.
The old part of the website seems fine with these changes but I am still getting an error with I try to get to the Articulate blog i.e.
The model item passed into the dictionary is of type 'Articulate.Models.ListModel', but this dictionary requires a model item of type 'Umbraco.Web.Models.RenderModel'.
What am I missing? Any help would be greatly appreciated
Hello, I'm trying to achieve the same thing. Any luck?
Hi Dezignwhiz
Yes I managed to find a workaround. In short I created a new Articulate theme and the root document (of the blog) starts with the following:
@model Articulate.Models.IMasterModel @using ClientDependency.Core.Mvc @using Articulate; @{ var siteRoot = Model.AncestorsOrSelf().Last(); var navModel = new Umbraco.Web.Models.RenderModel(Model); ...
} Then comes my HTML (copied from the old part of the site for a similar look) with the call to the partial with the navigation @Html.Partial("MainNav", navModel)
The view starts with the following: @model Umbraco.Web.Models.RenderModel
@{ //From the currentpage - get the root node (Select the node at level 1) var rootNode = Model.Content.Site(); var selection = rootNode.Children.Where(x => x.IsVisible()); ... }
Then the HTML where I enumerate the descendants
@foreach (var item in selection) {...}
Hope this helps :-)
is working on a reply...