[Pmwiki-users] Searching for information about PmWiki
Christian Ridderström
chr
Sun Jan 18 08:07:25 CST 2004
On Sun, 18 Jan 2004, Christian Ridderstr?m wrote:
> Nice tip! Oh... wait, rats... then the local additions I've made to the
> PmWiki group won't be found be others...
>
> Right now I'm using this code to preven robots from some places:
>
> if($action and $action!='browse' )
> $robots="noindex,nofollow";
> else
> $robots="index,follow";
>
> $HTMLTitleFmt = array ("<title>\$Titlespaced</title>",
> "<META CONTENT=\"$robots\" NAME=\"robots\">");
>
> It just need to somehow check if the source of the page comes from
> wikilib.d/
> and if it does, then use $robots="noindex,nofollow";
This seems to work:
// Return path of page source or empty string if page does not exist
function PageSource($pagename) {
global $WikiLibDirs,$PageFileFmt;
$pagefile = FmtPageName($PageFileFmt,$pagename);
if (!$pagefile) return "";
foreach ($WikiLibDirs as $dir) {
if (file_exists("$dir/$pagefile")) return "$dir/$pagefile";
}
return "";
}
!! Return true if the source of the page comes fromm wikilib.d
function IsPageFromWikiLib($pagename) {
return !(strpos(PageSource($pagename), "wikilib.d/") === false);
}
if(($action and $action!='browse') or IsPageFromWikiLib($pagename))
$robots="noindex,nofollow";
else
$robots="index,follow";
$HTMLTitleFmt = array ("<title>\$Titlespaced</title>",
"<META CONTENT=\"$robots\" NAME=\"robots\">");
Patrick, maybe you should consider adding something like this to the other
robot-handling code.
/Christian
--
Dr. Christian Ridderstr?m, +46-8-768 39 44 http://www.md.kth.se/~chr
More information about the pmwiki-users
mailing list