?

Log in

No account? Create an account

Previous Entry | Next Entry

Tag cloud question

  • Sep. 1st, 2006 at 11:43 AM
Is there a way to unlist a certain tag from the tag cloud? I have a "rl" tag that tags, well, all my real life posts. But there's almost 200 of them, and all but 4 are flocked. None of my other tags come close to reaching that number, and so the 'rl' tag is huge, and the rest are all the same size. Is there a way to ignore that tag in the cloud, or make it so that it's excluded from the count, so it's automatically the biggest size without skewing the ratio like it does now?

I'm very knowledgeable about CSS, and can mostly figure out S2.

Comments

( 2 comments — Leave a comment )
camomiletea
Sep. 1st, 2006 06:57 pm (UTC)
Yes, you can do this. add the following to your theme layer.

function print_module_tags(string title) {
    var Page p = get_page();
    var TagDetail[] tags = $p->visible_tag_list();
    var int most_count = 1;
    if (size($tags) < 1) { return; }
    open_module("categories", $title, ""); # TODO: Link to the TagsPage?

    var string[] links = [];
  # First get the highest tag count there is
    foreach var TagDetail td ($tags) {
        if ($td.use_count > $most_count and $td.name != "rl") {
            $most_count = $td.use_count;
        }
    }

  # Now print the tag cloud
    foreach var TagDetail td ($tags) {
        var string uses = get_plural_phrase($td.use_count, "text_tag_uses");
        var string security = $td.visibility;
        var int tagtextsize = 7;

        if ($td.use_count > 1 and $td.name != "rl") {
            $tagtextsize = ($td.use_count * 16) / $most_count + 7; # Text size, in pixels, of this tag -- min is 7px, max is 23px
        }

        if ($*tag_display == "cloud" and $td.name != "rl") {
            $links[size $links] = """<a href="$td.url" style="font-size: ${tagtextsize}px;" title="$uses, $security">$td.name</a>""";
        } elseif ($*tag_display == "list") {
            $links[size $links] = """<a href="$td.url" title="$uses, $security">$td.name</a>""";
        }
    }

    print_module_list($links,"tagcloud");
    var string tags_url = $p.journal->base_url() + "/tag/"; # TODO: Need Page.view_url{"tags"} which doesn't exist yet.
    print """<div class="widget-footer"><a href="$tags_url" title="$*text_sidebar_tags">$*text_sidebar_tags</a></div>\n""";
    close_module();
}


I have not tested this, so let me know if you have problems with this.
meinterrupted
Sep. 1st, 2006 07:32 pm (UTC)
It worked perfectly; thank you!
( 2 comments — Leave a comment )

Latest Month

March 2016
S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  

S2 Help Communities

Tags

Powered by LiveJournal.com
Designed by chasethestars