]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/rel_attribute_for_links.mdwn
web commit by NicolasLimare: tagged
[ikiwiki.git] / doc / todo / rel_attribute_for_links.mdwn
1 A rel="" attribute is desirable for links, for example to
2
3 * limit the interest of comment spam with rel="nofollow" for anonymous wiki contributions (see [Google](http://googleblog.blogspot.com/2005/01/preventing-comment-spam.html))
4 * identify page tags with rel="tag" (see [microformats](http://microformats.org/wiki/rel-tag))
5 * define a social network with rel="friend co-worker met ..." for contacts (see [XFN](http://www.gmpg.org/xfn/))
6 * define a license with rel="license" for contacts (see [microformats](http://microformats.org/wiki/rel-license))
7
8 This patch adds this possibility to htmllink().
9
10     --- IkiWiki.pm.orig     2007-08-04 19:04:36.000000000 +0200
11     +++ IkiWiki.pm  2007-08-04 19:19:24.000000000 +0200
12     @@ -517,6 +517,8 @@
13                     $linktext=pagetitle(basename($link));
14             }
15      
16     +       my $rel=(defined $opts{rel} ? $rel=" rel=\"".$opts{rel}."\"" : '');
17     +
18             return "<span class=\"selflink\">$linktext</span>"
19                     if length $bestlink && $page eq $bestlink;
20      
21     @@ -546,7 +548,7 @@
22                     $bestlink.="#".$opts{anchor};
23             }
24      
25     -       return "<a href=\"$bestlink\">$linktext</a>";
26     +       return "<a href=\"$bestlink\"$rel>$linktext</a>";
27      } #}}}
28      
29      sub htmlize ($$$) { #{{{
30
31 This one uses it for tags:
32
33     <pre>
34     --- tag.pm.orig 2007-08-04 19:06:15.000000000 +0200
35     +++ tag.pm      2007-08-04 19:20:47.000000000 +0200
36     @@ -60,7 +60,8 @@
37      
38             $template->param(tags => [
39                     map { 
40     -                       link => htmllink($page, $destpage, tagpage($_))
41     +                       link => htmllink($page, $destpage, 
42     +                                        tagpage($_), rel => "tag")
43                     }, sort keys %{$tags{$page}}
44             ]) if exists $tags{$page} && %{$tags{$page}} && $template->query(name => "tags");
45
46 This can also help for css decoraton. An example of these patches in use: http://poivron.org/~nil/iki/japonesie/horizon_large/
47
48 — NicolasLimare
49
50 [[tag wishlist patch]]