I am integrating Articulate into an existing site where the site's Master template pulls in navigation, social media and other values set through configuration Doc Types.
Yes. And to clarify, I have my Master.cshtml in Templates that defines the , , navigation, social media bar, footer with @RenderBody() in the middle.
I am trying to utilize this same layout or template for the Articulate blog plugin which has themes.
In App_Plugins/Articulate/Themes/[My Custom Copied Theme]/Views/master.cshtml I attempted to copy code from my Master.cshtml in Templates, but get the following error right away:
Line 10: IEnumerable
Now, I am sure an option is to create a Template in Umbraco rather than the plugin and pull out blog posts, but I would like to leverage all that has been setup in the theme, but get the look of my site wrapped around it.
It is, but I do not think I am making any progress other than getting different errors.
I have never used Umbraco before and only slightly knowledgable of ASP.NET (versus very knowledgable in PHP and open source).
I was able to get a full site integration done and am majorly stuck on building out a blog with Articulate that matches the design of my site.
This seems like something that should be out of the box to have a Blog Plugin fit into the existing design of a site rather than total separate themes.
Given my knowledge level and having looked through a lot of resources out there, I think I've hit a wall on it.
Probably best to start simple here so you understand what is happening. What you want to do is totally possible you just have to understand what a layout is and the model it uses.
Let's take your List.cshtml for example. It requires a model of type Articulate.Models.ListModel which implements IPublishedContent.
Manually create a new/blank master template file at ~/Views/MasterTest.cshtml to test against
Put this header in your MasterTest.cshtml file: @inherits Umbraco.Web.Mvc.UmbracoViewPage<IPublishedContent>. This means that your Layout will always require that any page that is using it has a model of type IPublishedContent. It's worth noting that normal Umbraco templates by default have a model of type RenderModel but the UmbracoViewPage has some logic in it to convert between these two models so it doesn't care.
Put some simple template markup in it: <html><body>@RenderBody()</body></html>
Change your List.cshtml file to point to that layout: `Layout = "~/Views/MasterTest.cshtml"
The page and layout file should work without error
It would also be really helpful if you can list the full errors you are getting as your above post just tells me what code is causing an error but not what the error actually is.
I'm not exactly sure what you are asking in your question. Is this your Master.cshtml page for your Articulate theme, or is this a Master.cshtml file in your normal ~/Views folder?
If you have common UI structure that you want to use between your views, then you should use a Layout page - this is what that other post is all about and is what I'm assuming you were originally trying to do above. You can not just use @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.Master> for an Articulate view since that model has nothing to do with Articulate.
Your Layout page in MVC will use the Model that is given to it from the View that is being rendered. Layout pages do not operate outside of the View, they become part of the View. If you strongly type your Layout's model, then you won't be able to use that Layout with a View that does not have the same Model. This is a commonly asked question regarding ASP.Net MVC and I know can cause some confusion but this is how ASP.Net MVC is structured.
If you want to be able to use your Layout page between Views that have various models, you will need to make sure your Layout page uses a base model type for all of your Views - in the Umbraco world, this is IPublishedContent
Use Master.cshtml as template
Hi,
I am integrating Articulate into an existing site where the site's Master template pulls in navigation, social media and other values set through configuration Doc Types.
I have tried adding code like:
@{ Layout = null;
}
at the top of Master.cshtml in the Articulate theme, but get errors.
Are there ways I can use the overall template of the site, so that if that is updated, it will format the blog as well.
Can you please explain what your errors actually are?
Yes. And to clarify, I have my Master.cshtml in Templates that defines the , , navigation, social media bar, footer with @RenderBody() in the middle.
I am trying to utilize this same layout or template for the Articulate blog plugin which has themes.
In App_Plugins/Articulate/Themes/[My Custom Copied Theme]/Views/master.cshtml I attempted to copy code from my Master.cshtml in Templates, but get the following error right away:
Line 10: IEnumerable
Now, I am sure an option is to create a Template in Umbraco rather than the plugin and pull out blog posts, but I would like to leverage all that has been setup in the theme, but get the look of my site wrapped around it.
Thanks for any help!
Hi Andy,
This sort of seems like the same question as this one? assuming you've made some progress on your own with the above error.
https://our.umbraco.org/projects/starter-kits/articulate/discussions/54733-Articulate-integration-in-existing-site#comment-248626
It is, but I do not think I am making any progress other than getting different errors.
I have never used Umbraco before and only slightly knowledgable of ASP.NET (versus very knowledgable in PHP and open source).
I was able to get a full site integration done and am majorly stuck on building out a blog with Articulate that matches the design of my site.
This seems like something that should be out of the box to have a Blog Plugin fit into the existing design of a site rather than total separate themes.
Given my knowledge level and having looked through a lot of resources out there, I think I've hit a wall on it.
Hi Andy,
Probably best to start simple here so you understand what is happening. What you want to do is totally possible you just have to understand what a layout is and the model it uses.
Hopefully you read my reply since you are already pretty close: https://our.umbraco.org/projects/starter-kits/articulate/discussions/54733-Articulate-integration-in-existing-site#comment-248672
Let's take your
List.cshtml
for example. It requires a model of typeArticulate.Models.ListModel
which implementsIPublishedContent
.~/Views/MasterTest.cshtml
to test againstMasterTest.cshtml
file:@inherits Umbraco.Web.Mvc.UmbracoViewPage<IPublishedContent>
. This means that your Layout will always require that any page that is using it has a model of typeIPublishedContent
. It's worth noting that normal Umbraco templates by default have a model of typeRenderModel
but theUmbracoViewPage
has some logic in it to convert between these two models so it doesn't care.<html><body>@RenderBody()</body></html>
List.cshtml
file to point to that layout: `Layout = "~/Views/MasterTest.cshtml"It would also be really helpful if you can list the full errors you are getting as your above post just tells me what code is causing an error but not what the error actually is.
I am working on trying, but just out of curiosity, my Master currently has:
@using ContentModels = Umbraco.Web.PublishedContentModels;
@{ Layout = null;
}
Is that not the correct way as all templates reference
Hi Andy,
I'm not exactly sure what you are asking in your question. Is this your Master.cshtml page for your Articulate theme, or is this a Master.cshtml file in your normal ~/Views folder?
If you have common UI structure that you want to use between your views, then you should use a Layout page - this is what that other post is all about and is what I'm assuming you were originally trying to do above. You can not just use
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.Master>
for an Articulate view since that model has nothing to do with Articulate.Your Layout page in MVC will use the Model that is given to it from the View that is being rendered. Layout pages do not operate outside of the View, they become part of the View. If you strongly type your Layout's model, then you won't be able to use that Layout with a View that does not have the same Model. This is a commonly asked question regarding ASP.Net MVC and I know can cause some confusion but this is how ASP.Net MVC is structured.
If you want to be able to use your Layout page between Views that have various models, you will need to make sure your Layout page uses a base model type for all of your Views - in the Umbraco world, this is
IPublishedContent
Thank you. I was finally able to get it. I guess all the templates I had was implicitly defined.
is working on a reply...