Title display issue

Topics: Troubleshooting
Apr 22, 2012 at 11:41 PM

I am running a site that I upgraded from version 1.3 to version 1.4, and in my views, Model.Title no longer seems to have a value, whereas it did in my site when it was running as version 1.3.  How can I go about figuring out why this is?  Should I be using some other property?

Apr 23, 2012 at 12:42 AM

Just to update this, when I drop  @Display(Model.Header) into the view, all of a sudden I see two headers.

Apr 23, 2012 at 3:51 AM

Did you run the UpgradeTo14 migration? In 1.3 the title property was attached to the RoutePart. In 1.4 the title property is attached to the TitlePart. I blieve the migration process should take care of transferring the titles from Route to Title parts. 

Apr 24, 2012 at 1:31 AM

So I installed a clean version 1.4 of the framework to a new site and downloaded the theme, and the title still does not show up.  Has anyone else tried using the the "CityTheme" in Orchard v1.4?

Coordinator
Apr 24, 2012 at 1:32 AM

Maybe it's a bug in the theme? What happens if you use the default theme?

Apr 24, 2012 at 4:40 AM

The default theme shows the title, but I'm just curious why Model.Title does not display a title.  Is there something I can replace this with to make the theme work?

Coordinator
Apr 24, 2012 at 5:03 AM

From where? Model can be pretty much anything, depending what template you're in.

Apr 24, 2012 at 5:37 AM

Sorry, I'm somewhat new to the platform.  Here is a node from Layout.cshtml:

@if(displayContent && IsHomepage)

{

              @Html.Partial("_Home")            

<div class="clear"></div>       

}

 

Here is _Home.cshtml:

<div id="right">

                <h2>@Display(Model.Title)</h2>

                <div id="welcome">

                @Display(Model.Content)

                 </div>

</div>

Coordinator
Apr 24, 2012 at 8:02 PM

If it's not showing anything then it means that nothing set Layout.Title.

Apr 25, 2012 at 4:56 AM

Actually, it appears that every other theme is utilizing Parts.Title within Core, and somehow my theme is not.  There is no direct reference to this component, so how is this pulled into the page?  Is this somehow related to Monarch's original comment?

Apr 25, 2012 at 4:59 AM

To clarify, there is no direct reference to a title within any working Theme.  For example, the word "title" is not mentioned once in any file in the Theme Machine theme, and this theme works perfectly.

Coordinator
Apr 25, 2012 at 8:00 AM

That's because the document.cshtml is not defined in theme machine, it's inherited from safe mode if I remember correctly.

Apr 25, 2012 at 2:23 PM

@bleroy: You're right. (not that I would think you wouldn't be).

Apr 26, 2012 at 3:55 AM

Layout.Title does not seem to be set in a single theme as far as I can tell.  Additionally, I'll just reiterate that this theme works fine in v1.3, and if I download a fresh copy of Orchard 1.4 and a fresh copy of the same theme, it does not work.  So is there something that has changed within the framework that would cause this to occur?  @bleroy: I appreciate your help, I just want to understand what is going on here.  The title is not the only thing that has disappeared.  When I signed in, I used to see an "Edit" button above the content, so there are a few issues here that seem to be unrelated to the theme itself.

Coordinator
Apr 26, 2012 at 4:39 AM

What is it exactly that you are trying to do?

The edit button issue is a separate one. If you do a search about it, you'll have no trouble finding the solution: http://www.davidhayden.me/blog/display-edit-links-around-content-and-widgets-in-orchard-cms

Apr 27, 2012 at 3:38 AM

I appreciate the info on the edit link...it was secondary to the main issue I'm having, so I had not yet looked into it.

 

My main issue is that I'm trying to display the title on my page.  Prior to upgrading, the title was displayed using the following line:                 <h2>@Display(Model.Title)</h2>  

 

This does not work anymore.  I'm just trying to display the title as the header to my content...that's it.

Coordinator
Apr 27, 2012 at 5:01 AM

And I cannot reproduce what you're seeing. The title is displayed in 1.4 exactly the same way it was in 1.3. That's why I think you're using a module that does not set the title on the layout properly. I have no idea why it worked before and doesn't now, because I have no idea what that module is.

Apr 28, 2012 at 1:22 AM

It's a theme called CityTheme.  I downloaded a fresh copy of Orchard 1.4, downloaded the theme, and this theme does not work.  No modules are affecting the display that I know of.  Could you just try pulling down this theme and you will be able to reproduce this issue.  If it's possible, I would upload my site to you and you could see what I'm talking about, but to reiterate, it's just a fresh copy of Orchard 1.4, and a theme called CityTheme, which doesnt look to be doing anything special, and certainly worked in v1.3.  I am still digging into this and looking at other themes to see what the difference could be, but so far no luck.

Coordinator
Apr 28, 2012 at 1:43 AM

I'm sorry, no. Did you try to contact the author of that theme?

May 2, 2012 at 4:39 AM

So for those who are having the same issue, the author has said he would look into the issue, but I was able to correct this by removing Model.Title from the _Home and _Inner views, and inserting Model.Header into the Content view, which utilizes Parts.Title within Core.  I'm still not sure why this didnt work before because Parts.Title just uses Model.Title, so it must be something to do with the model being passed in.  

The point is, this value is null or empty, whereas in v1.3 it was not.  Hopefully this helps someone else.