Many of the themes for GraffitiCMS contain an index.view which will display the first few lines of your post as an excerpt on the front page.   Here are some tips on how you can better control what is displayed in that excerpt, and why you may want to enhance what is displayed.

This serves to avoid having pages with duplicate content which is an SEO sin, and to also allow readers of your site to view summaries of many of your articles on the same page. 

With the addition of the new GraffitCMS Blog extensions plugin, the first few lines of your post are also used in the trackback text when trackbacks are posted to other sites which cite your content.

So you can see how you would want to make the beginning of your post inviting to engage the reader to read the full article posting if they are viewing your index page, or see your blog in a remote trackback entry.

I stumbled upon Josh Ledgard‘s tip for showing the full post content on the homepage, where he shows you how to change the index.view to show the full post, instead of the excerpt on the home page.  While this is the opposite of what I would like to do, it did show me the syntax that is used to define how much of your post is used for the excerpt creation.

   1: $post.Excerpt('Continue reading...',$post.Title, 300)

So the above line in the index.view sets the continuation text, which is displayed with the post to link to the full article, the link name (which is set to the post title above), and the number of characters to use from the beginning of the post to display in the excerpt.

While this is all well and good for ease of use, it can lead to some poorly formatted excerpts from your content, since it appears to ignore formatting and links within that character count.  Depending on where that character count is reached, it could end up not displaying as you wish in the excerpt. I can understand why you would want to exclude the links from being links in the excerpt, since you would prefer the reader continue onto the full post, instead of link jump to some other site without reading your full post.

If you want to control what is used for the excerpt, a better way is to use the Body and Extended Body sections in the GCMS post editor.  If you defined a body, and an extended body, it appears that GCMS will use the Body section to define the excerpt displayed in your index.view.  It will also display proper formatting of line breaks and links as well, which may yield a better appearance for your content.  When the reader views your complete post url, the post is viewed as a single complete post with the body on top of the extended body.

If you use Windows Live Writer, you can choose where to split your post by inserting the Split Post entry from the Format menu as well, which will insert <!–more–> to where the split should be.

I like the fact that they though of making it easy to build the excerpts automatically, but still give you the option to define your excerpt on a post by post basis if you wish.  I am hoping a wiki is made available on the GCMS site to document all of the syntax used for Chalk extensions to provide better understanding of what is available.  Only then as more is known, will we really start to see some great things flourish using the GraffitiCMS platform.

Technorati Tags: graffiticms,
  • Hello,i'm new to grafitti cms and i found your post while searching for a way to display a post tags like you have done(Tags: GraffitiCMS, Web). I want to do this in the index.view for each post i display. Could you please tell me how you did that? the graffiti site doesn't provide any info about doing this.Thank you in advance

  • John Hoiland

    Hello,Now that the original graffiti forums have disappeared I am scrambling about trying to figure some things out on sites I haven't touched in a while! I appreciated your post and I had a follow up question I thought you might be able to tackle.I am trying to simplify the home page ONLY. Josh's modification of the index.view file is great, but it changes all of the categories.I am looking to change only the home page itself. As I remember I should be able to do this simply in the naming of the view file, but I am doing something wrong.Here is my view as I like it…#foreach($post in $posts)<div class="item"> <h2>$post.Title</h2> $post.Body()</div>#endNow what do I name it? I have tried index.home.view and home.index.view…Thanks

  • Jef

    Ouch, it's been awhile since I looked at Graffiti since I switched to WP.index.view would have been the main "home" page that shows the index ofposts if I remember.This is the view you customize how you want posts displayed in an index/liston your home page. You can choose to show excerpts, etc.layout.view is how you modify the entire layout, while index.view is how themain homepage list is displayed.Good luck!