A common need when using Graffiti CMS is to display a single post on the home page. Graffiti CMS provides has a featured post flag that can be set so that the Content Management System knows which post is the currently featured post. This is a quick and easy way to display a single specific post on the home page. Keeping in mind that only one post can be featured at a time.
The following code demonstrates one method of displaying the featured post. Disclaimer: There might be a better way to handle this, but this is the method that I have used in the past and I haven’t had a reason to search for a better method.
Place the following code in the index.view file (or any .view file where applicable)
#set($post = $data.Featured())
<a href=”$post.Url” title=”$post.Title” rel=”bookmark”>$post.Title</a>
#if ($post.ImageUrl != “”)
<img style=”float: left; padding: 0px 10px 2px 0px;” src=’$macros.Link($post.ImageUrl)’ />