/[drupal]/contributions/modules/nofollow/README.txt
ViewVC logotype

Contents of /contributions/modules/nofollow/README.txt

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sun Mar 2 17:33:38 2008 UTC (20 months, 3 weeks ago) by jonnyp
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
first upload of nofollow module
1 Nofollow module
2 ===============
3
4 This is a quick and dirty module to allow you to nofollow menu items and taxonomy terms within drupal to help control the flow of pagerank through your site.
5
6 This is a technique that allows you to focus importance on certain pages rather than others - for example you may wish to avoid linking to the Privacy Policy on every page in the eyes of the search engines, but still allow users to find it from any part of the site. By reducing the importance of the Privacy policy, contact us/about us pages etc you allow more link juice to flow to the more important parts of the site.
7
8 Installation
9 ============
10
11 The module should create its tables automatically when you enable it (though I am unsure of the syntax for pgsql so you will need to do it by hand there) however in order for it to have any effect you need to use custom theming functions.
12
13 These are very easy to set up - simply add the code below into your template.php file and replace yourtemplatename_ with the name of your template - eg bluemarine_
14
15 ---------------------
16
17 function yourthemename_menu_item_link ($item,$link_item) {
18 $q=db_query("SELECT * FROM {nofollow} WHERE type='menu' AND id='$link_item[path]'");
19 $ob=db_fetch_object($q);
20 $dofollow=nofollow_dofollow_check($ob);
21 $options=!empty($item['description']) ? array('title' => $item['description']) : array();
22 if (!$dofollow) $options['rel']="nofollow";
23 return l($item['title']. " $isit", $link_item['path'], $options, isset($item['query']) ? $item['query'] : NULL);
24 }
25
26 function yourthemename_block ($block) {
27 if (strstr($block->module, 'taxonomy_')) {
28 // if this block is a taxonomy block of some sort - whether
29 // taxonomy_context, taxonomy_menu etc
30 // then filter using patterns from nofollowlist
31 $block->content = preg_replace_callback('!<a.*?href="([^"]+)".*?>!', 'nofollow_link_replace', $block->content);
32 }
33 $output = "<div class=\"block block-$block->module\" id=\"block-$block->module-$block->delta\">\n";
34 $output .= " <h2 class=\"title\">$block->subject</h2>\n";
35 $output .= " <div class=\"content\">$block->content</div>\n";
36 $output .= "</div>\n";
37 return $output;
38 }
39
40 ---------------------------
41
42 If the template.php file does not exist please create an empty one, prefixing the code above with <?
43
44
45
46 Using nofollow.module
47 =====================
48
49 This module uses the same system as the block module's page specific visibility system to give you page specific nofollow control, so it should be familiar and easy to use.
50
51 To control whether menu items are nofollowed or not, simply edit the menu item. Below the submit button will be the Nofollow/Dofollow options. As with blocks you are given the following options:
52
53 * Dofollow on the listed page(s) only
54 * Dofollow on every page except the listed pages
55 * Dofollow when the following PHP code returns TRUE
56
57 This should give you full flexibility on where and when menu items are nofollowed or not. Note that you control if it is Dofollowed, not nofollowed
58
59 For taxonomy terms I wasn't entirely sure what to do as there are so many ways of presenting your categories to the user. Personally I use taxonomy_context and occasionally taxonomy_menu modules to display category information, so I have built the module around that.
60
61 Essentially it borrows the function from Nofollowlist which checks text for links, decides if it should be nofollowed or not, and applies it to the output of any block whose name begins 'taxonomy_' - its a bit of a kludge but it seems to work.
62
63 If there are other situations where there are links to categories you would like nofollowed then let me know and I'll work on including them.
64
65 To enable or disable nofollow just go to your taxonomy admin pages and 'edit term'. Once again you will get the familiar block visibility form to decide where and when nofollow is applied.
66
67 Credits
68 =======
69
70 Regular expressions and filter technique borrowed from Nofollowlist
71 Visibility options lifted from block.module
72
73 Cheers!

  ViewVC Help
Powered by ViewVC 1.1.2