This is a bit old - you may or may not notice the date on this post but it's over a year old. That doesn't mean it's not useful but we all know how fast things chance on the web so there's a chance that techniques and technologies described here could be a little dated.

Statamic plugins

I’ve recently been playing around with the Statamic CMS for a project and generally I’m impressed. It is a nicely put together CMS that comes without the need for a database.

One thing I have noticed though is that as a developer you can tell this is a relatively new CMS and doesn’t have the maturity and features of something such as WordPress. That said I don’t think it’s planning to emulate the likes of WordPress and wants to be a much simpler system. There is great support via twitter etc and it seems to be growing a community. Which is the key and strength of platforms such as WordPress. So in the spirit of this I’ve shared a couple of plugins I’ve created myself to solve a few little niggles I’ve come across so far.

The first two are related, when using an excerpt there is a truncate feature but the application of it for using a word count leaves an issue of open tags in HTML content and can cause some problems. I’ve put together a basic close tags add on which you can find on github here – Statamic-Close-Tags. However that doesn’t quite work within the truncate function as it is applied.

{{ truncate:words limit="20" }} {{ content|close_tags }} {{ /truncate:words }}

Using close tags there applies the modifier before the truncation. So I’ve created a new words truncate modifier which also closes tags, that one is at statamic-word-truncate and you can apply it quite easily onto the content tag.

{{ content|word_truncate:100 }}

The second issue I’ve had is using the Redactor WYSIWYG editor as it sometimes has issues with smart quotes and Unicode characters (see my post here). So I’ve stuck together a plugin to convert some common trouble makers to unicode characters so they display properly and you’ll find that one here Statamic-kill-quotes.

I’m looking forward to seeing what the upcoming new version of Statamic is capable of but in the meantime I’ll happily use and recommend the current version and hopefully these little plugins can help some other people out.