This project is read-only.

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">

How do I include the published date in my template?


Richard Garside.

Apr 14, 2011 at 12:45 AM

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


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
    • Footer
      ContentZone Shape
    • Header
      ContentZone Shape
    • Content
      ContentZone Shape
    • Blog
    • Title
      "Amazon Simple Email Service and MailChimp"
    • Slug
    • Path

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.

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.

Apr 14, 2011 at 8:51 PM

What does your placement file look like?

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