Showing dates on blog posts

Topics: Writing themes
Apr 14, 2011 at 12:40 AM

My theme did show blog post dates before, but since upgrading to 1.1 these have vanished.

This part of Content.cshtml previously showed them:

 @if (Model.Meta != null) {
    <div class="metadata">
        @Display(Model.Meta)
    </div>
}

How do I include the published date in my template?

Thanks,

Richard Garside.

Coordinator
Apr 14, 2011 at 12:45 AM

I have this inside my Parts.Common.Metadata.Summary.cshtml:

Model.ContentPart.PublishedUtc

Apr 14, 2011 at 10:20 AM

Sorry, I forgot to say. I also have a Parts.Common.Metadata.Summary.cshtml template.

I've investigated and Model.Meta does == null, so it doesn't even try to find the Metadata template. I added an else to the above code and it displayed the content inside the else instead. I had a look inside using the new shape tracing design tool and couldn't find any sign of Meta in the model. This is the model copied from the design tool for Zone[Content] > Content > List > Content[0]

  • Model
    Content Shape
    • Child
      ContentZone Shape
    • ContentItem
      ContentItem
    • Footer
      ContentZone Shape
    • Header
      ContentZone Shape
    • Content
      ContentZone Shape
    • Blog
      BlogPart
    • Title
      "Amazon Simple Email Service and MailChimp"
    • Slug
      "amazon-simple-email-service-and-mailchimp"
    • Path
      "blog/amazon-simple-email-service-and-mailchimp"

I found Model.ContentItem.CommonPart.PublishedUtc in there, but that seems to be a bit far down the tree and makes me think that I've missed something.

Coordinator
Apr 14, 2011 at 8:13 PM

Does your content type have the common part?

Apr 14, 2011 at 8:35 PM

It's a blog post.

Coordinator
Apr 14, 2011 at 8:51 PM

What does your placement file look like?

Apr 14, 2011 at 9:20 PM
<Placement>
	<Match DisplayType="Detail">
		<Place Parts_Tags_ShowTags="Footer:1"/>
	</Match>
	<Match DisplayType="Summary">
		<Place Parts_Tags_ShowTags="Footer:4"/>
		<Place Parts_Comments_Count="Footer:5" />
	</Match>
</Placement>