PmWiki /
Url Approvals
This page explains how to discourage "link spamming" on your wiki site using PmWiki's urlapprove.php script.
Using urlapprove.phpOccasionally spammers may try to add large number of (sometimes hidden) URLs to pages because they think it will improve their search engine rankings -- which it probably won't. The urlapprove.php script works against these spammers' purpose by
include_once('scripts/urlapprove.php');
Site.ApprovedUrls page.
You may also pre-approve sites by by adding them to the Site.ApprovedUrls page.
Limiting unapproved urls per pageYou can limit the number of unapproved links per page. If the limit is exceeded, the page cannot be saved. This is useful because spammers like to write long link lists, which is rare for normal authors. Example: To set the limit to 5 unapproved links, add the following line to a configuration file:$UnapprovedLinkCountMax = 5;
include_once('scripts/urlapprove.php');
Handling of Unapproved LinksYou can also change the disapproval message defined in the $UnapprovedLinkFmt variable, for example:include_once('scripts/urlapprove.php'); $UnapprovedLinkFmt = "[$[Link requires approval]]<a class='apprlink' href='\$PageUrl?action=approvesites'>$[(approve)]</a>"; $UnapprovedLinkFmt = "<b>external link not allowed</b>";
SideBar caveatPlease note that in general you need to go to the sidebar page in order to approve links in the sidebar. The reason for this is that the approve mechanism only approves links on the current page.Initial setupAfter initial setup all existing links become un-approved. To find out which pages are affected one can use an RSS feed on AllRecentChanges. All pages with unappreved links will show up there.Technical tipsUrls are approved by adding them to a "white list", defined in the variable$WhiteUrlPatterns , which is set in the local/config.php file.To add multiples urls, use the separator | (vertical bar). For example:
$WhiteUrlPatterns = "http://example.com/|http://example.net/|http://example.org/"; $WhiteUrlPatterns[] = 'http://[^/] \\.nz'; $WhiteUrlPatterns[] = 'http://[^/] \\.au'; Site.ApprovedUrls write in local/config.php (after the script inclusion line):
$ApprovedUrlPagesFmt = array('OtherGroup.OtherName');
array('$DefaultGroup.ApprovedUrls');
$UnapprovedLinkFmt = "\$LinkText<a class='apprlink' href='\$PageUrl?action=approvesites' title='\$LinkUrl'>$[(approve sites)]</a>"; About rel='nofollow'By default, PmWiki creates external links that are not followed by search engines. Here are release notes from pmwiki-2.0.beta20 (30-Jan-2005):First, the $UrlLinkFmt variable has been modified so that links to external urls automatically have a rel='nofollow' attribute added to them, to help combat wiki spam as described in http://googleblog.blogspot.com/2005/01/preventing-comment-spam.html. Site administrators can customize $UrlLinkFmt and $UnapprovedLinkFmt to supply or omit rel='nofollow' as appropriate.
See Also
|