summaryrefslogtreecommitdiff
path: root/inc/template.php
diff options
context:
space:
mode:
authorAnika Henke <anika@selfthinker.org>2013-08-01 14:10:53 -0700
committerAnika Henke <anika@selfthinker.org>2013-08-01 14:10:53 -0700
commit8e3ca8dae2a45ba098e47691cf87f5b53d3442bd (patch)
treebf7453e6259af96a5dc579428aad75e77da1161d /inc/template.php
parent4fb6e51447e840624b59742bec61641d606f5006 (diff)
parentb8bc53ce8da2f0fb9cfedb01df6507b29f32daaa (diff)
downloadrpg-8e3ca8dae2a45ba098e47691cf87f5b53d3442bd.tar.gz
rpg-8e3ca8dae2a45ba098e47691cf87f5b53d3442bd.tar.bz2
Merge pull request #247 from splitbrain/FS#2766
Improve nofollow behaviour for ?do=index
Diffstat (limited to 'inc/template.php')
-rw-r--r--inc/template.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/inc/template.php b/inc/template.php
index 66cbbe471..bb5f2cd53 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -541,6 +541,7 @@ function tpl_actionlink($type, $pre = '', $suf = '', $inner = '', $return = fals
* @var string $accesskey
* @var string $id
* @var string $method
+ * @var bool $nofollow
* @var array $params
*/
extract($data);
@@ -555,10 +556,11 @@ function tpl_actionlink($type, $pre = '', $suf = '', $inner = '', $return = fals
$akey = 'accesskey="'.$accesskey.'" ';
$addTitle = ' ['.strtoupper($accesskey).']';
}
+ $rel = $nofollow ? 'rel="nofollow" ' : '';
$out = tpl_link(
$linktarget, $pre.(($inner) ? $inner : $caption).$suf,
'class="action '.$type.'" '.
- $akey.'rel="nofollow" '.
+ $akey.$rel.
'title="'.hsc($caption).$addTitle.'"', 1
);
}
@@ -595,6 +597,7 @@ function tpl_get_action($type) {
global $INFO;
global $REV;
global $ACT;
+ global $conf;
// check disabled actions and fix the badly named ones
if($type == 'history') $type = 'revisions';
@@ -604,6 +607,7 @@ function tpl_get_action($type) {
$id = $ID;
$method = 'get';
$params = array('do' => $type);
+ $nofollow = true;
switch($type) {
case 'edit':
// most complicated type - we need to decide on current action
@@ -641,6 +645,10 @@ function tpl_get_action($type) {
break;
case 'index':
$accesskey = 'x';
+ // allow searchbots to get to the sitemap from the homepage (when dokuwiki isn't providing a sitemap.xml)
+ if ($conf['start'] == $ID && !$conf['sitemap']) {
+ $nofollow = false;
+ }
break;
case 'top':
$accesskey = 't';
@@ -711,7 +719,7 @@ function tpl_get_action($type) {
return '[unknown %s type]';
break;
}
- return compact('accesskey', 'type', 'id', 'method', 'params');
+ return compact('accesskey', 'type', 'id', 'method', 'params', 'nofollow');
}
/**