Mephisto - tag clouds
Mephisto has a wide range of plugins, one of which produces a simple tag cloud.
Installing this plugin is pretty simple and this article also demonstrates which files need editing to change default text sizes and how to limit upper text sizes in different areas of your site.
Start off by logging into your server and navigating to your root Mephisto folder:
cd public_html/mephisto_install
The layout of any Ruby on Rails application is pretty much identical and external plugins are usually installed in the vendor/plugins directory. Navigate there now:
cd vendor/plugins
Let's install the tag cloud plugin:
svn co http://modzer0.cs.uaf.edu/repos/hank/code/rails/mephisto/mephisto_tag_cloud
The plugin is now installed in the mephisto_tag_cloud directory.
By default the font sizes range from 0.5em to 2em. Now for me, those defaults are far too small or not big enough. I'm going to change the smaller limit to 0.9em and the upper limit to 3em.
It's worth noting that I probably won't use anything near 3em on my site but I would like the option of doing do. The upper font size can be defined depending on where I want the tag cloud to appear (this will be discussed further down).
Let's edit the file containing these default sizes:
nano mephisto_tag_cloud/lib/mephisto_plugins/tag_cloud.rb
Notice the third line of code:
def size_tag(tag, largest = 2, smallest = 0.5)
Change these default sizes to ones appropriate to your site. For this site I have:
def size_tag(tag, largest = 3, smallest = 0.9)
At this stage you will need to restart the server. If using Litespeed:
sudo /usr/local/lsws/bin/lswsctrl restart
That's the basics of the plugin done. Now we need to adjust the layout of the site to use the plugin so log into your Mephisto admin area and navigate to the 'Design' tab and click on the layout.liquid link.
The layout.liquid template is the framework of the site - it includes the headers, sidebars and footer of the website pages.
In this example, we are going to add a tag cloud in the sidebar. Due to the number of themes available, I will demonstrate using the default 'simpla' theme. In the layout.liquid template, find the sidebar div and, at the end of the div, enter the following code:
<h2>Tags</h2>
{% for tag in site.tags %}
{{ tag | size_tag }}
{% endfor %}
Providing you have some articles with tags, refreshing your site will give something like this:
To me, that is difficult to read and shows why it may be necessary to limit the upper font size in different areas of the website. For example, if the tag cloud were placed in an article, that font size may be appropriate, but for a sidebar it is too big.
To limit the font size simply add a caveat to the layout.liquid code shown above. To limit this sidebar tag cloud to 1.6em, add ': 1.6' as follows:
<h2>Tags</h2>
{% for tag in site.tags %}
{{ tag | size_tag: 1.6 }}
{% endfor %}
This produces a far more readable tag cloud:
Naturally, if you have no plans to use a tag cloud in more than one area, you could 'hard code' the font sizes in the mephisto_plugins/tag_cloud.rb as shown above.
However, I like flexibility so I set the upper limit quite high in the tag_cloud.rb and then set the upper font size in the relevant liquid template.
Plugin author: Hank
PickledOnion
Digg it |
del.icio.us |
reddit |
StumbleUpon

Subscribe to Feed