« Back to blog

Blog: Recent Comments CakePHP Element

Graham Weldon

12 November, 2008

Another little move forward in the scheme of things. I now have a Recent Comments element on some of the pages to indicate the latest 5 comments that have been made on the blog overall. I am not entirely certain that this is ideal moving forward. If traffic picks up on this site, there could be multiple per day, and this will tick over fairly regularly. What I might consider doing is storing a counterCache on the BlogPost model, which should automagically update as comments are made. This should, in turn update the 'modified' automagic field, creating an orderable index by which I could list the last commented posts.

So, rather than listing the last comments, I list the most recently commented on posts. This isn't something I have seen anywhere, its just something I thought could assist the diversification of content thats being presented at any point in time. With a particularly interesting post, using the current element, you could potentially have the last 5 comments based on a single post.

I guess that indicates to the viewer that its somewhat of a hot topic, but do I want to do this, or do I want to push out more keywords for the search engines? I guess I don't. This is not a redevelopment to list myself on search engines. If it were, you'd be plagued with Google adsense already.

This is another point that I would be interested to hear peoples feedback about. What method of displaying recent comments would be most useful, in terms of site navigation... and while you are at it, what pages should these elements be on?