How to make a Mephisto Plugin
Posted by hank, Sun Feb 25 19:29:00 UTC 2007
So, I figured I might as well provide a quick tutorial on how to make Mephisto Plugins currently. Many of the old plugins are broken, so there needs to be a resurgence of plugin development. Here’s the basic structure of the Tag Cloud plugin:
mephisto_tag_cloud
- init.rb README
- lib
- mephisto_plugins
- tag_cloud.rb
As you can see, the structure is very simple. Here’s my code for init.rb
Liquid::Template.register_filter(MephistoPlugins::TagCloud)
That’s it! No require or anything! Next, I edited lib/mephisto_plugins/tag_cloud.rb:
module MephistoPlugins module TagCloud def size_tag(tag, largest = 2) size = (Tag.find_by_name(tag).taggings(true).length + 18).to_f / 18 size = largest if size > largest "<span style='font-size: #{size}em'><a href='/tags/#{tag}'>#{tag}</a></span>" end end end
Holy crap that barely any code at all! So, the moral of the story is that it’s very easy to make the plugins once you figure out what to do.

Blog Posts
February 27, 2007 @ 05:17 PM
thanks. keep up the good work!
May 29, 2007 @ 04:32 PM
Hi! Excelent Post! Just a question, how do you embed the plugin in a page? Can it be embeded in an article? Thanks.
May 29, 2007 @ 04:39 PM
For this one, I just put this in my layout:
That’s all that’s needed.
February 28, 2008 @ 04:18 PM
Isn’t this a filter instead of a plugin? Or am i wrong?