In Part Two, we displayed a nicely formatted publication date on the blog post page.
Finally, in Part Three we shall change the blog listing.
In the Settings section, expand Partial View Macro Files.
Select LatestBlogPosts.cshtml.
Macros are beyond the scope of this lesson, but you don't need to understand them right now.
Scroll down to find the blogpost-date
element and change it to use a nicely formatted Publication Date, i.e.:
Further up in the view, you also need to redefine the blogposts
variable:
Because we are sorting by a custom property we need to use the generic Value
method.
Save the partial view - a confirmation message should appear confirming that the Partial view has been saved.
Now view both the Blog overview and the blog posts themselves in the browser to confirm that all is working as expected.
Nice job! In this lesson, you've learned what a Document Type is and how to add a new Property to it. You've also learned how to change Templates and sort by custom Properties.