while using partial views in the blog post I don't get the title of the blog when a specific blog is selected. it shows on the blog list but not when the specific blog is selected for viewing it.
This is the Blog page where you can see the title:
It seems when you are using BlogItem you get the name and when you are using BlogPage you are not, my guess is that BlogPage is just a parent container of the the actual BlogPage 🙂
Partial views in creating site from scratch
while using partial views in the blog post I don't get the title of the blog when a specific blog is selected. it shows on the blog list but not when the specific blog is selected for viewing it.
This is the Blog page where you can see the title:
Hey Ishan,
It looks like this is just because it is two different views that are used?
Can you maybe paste the code behind this here so there is something to work with? 😁
Actually I am new to umbraco so I am following the tutorials and learning from it how to build a site from scratch.
this is the blog item template code
@using ContentModels = Umbraco.Web.PublishedContentModels; @{ Layout = "Master.cshtml"; }
This one is for the blog page template:-
@using ContentModels = Umbraco.Web.PublishedContentModels; @{ Layout = "Master.cshtml"; }
And this is the partial view i want to create for displaying it in 3 different regions:
@using ContentModels = Umbraco.Web.PublishedContentModels; @{ Layout = "Master.cshtml"; }
No worries, I am still fairly new to Umbraco myself, we all start somewhere 😉
I think your problem is that you are using different models here:
It seems when you are using BlogItem you get the name and when you are using BlogPage you are not, my guess is that BlogPage is just a parent container of the the actual BlogPage 🙂
yes but in the partial view they inherit both of them. its what I guess is because we have declared blog item as child of blog page.
in partial view they are rendering both models I guess to my knowledge.
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{ var selection = Model.Content.Site().FirstChild("blogPage").Children("blogItem") .Where(x => x.IsVisible()); }
is working on a reply...