From 74ef17786eb9ce751a8dd7c66ab7523efa92c79f Mon Sep 17 00:00:00 2001
From: Christopher Smith <chris@jalakai.co.uk>
Date: Thu, 1 Aug 2013 22:46:16 +0200
Subject: [PATCH] include namespace links when index access from the wiki start
 page and no automatic sitemap.xml is being generated.

---
 inc/html.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/inc/html.php b/inc/html.php
index 53a100ec7..5f94d7dce 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -854,13 +854,17 @@ function html_index($ns){
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function html_list_index($item){
-    global $ID;
+    global $ID, $conf;
+
+    // prevent searchbots needlessly following links - only necessary when accessed from the homepage and no sitemap.xml is being generated
+    $nofollow = ($ID != $conf['start'] || $conf['sitemap']) ? ' rel="nofollow"' : '';
+
     $ret = '';
     $base = ':'.$item['id'];
     $base = substr($base,strrpos($base,':')+1);
     if($item['type']=='d'){
         // FS#2766, no need for search bots to follow namespace links in the index
-        $ret .= '<a href="'.wl($ID,'idx='.rawurlencode($item['id'])).'" title="' . $item['id'] . '" class="idx_dir" rel="nofollow"><strong>';
+        $ret .= '<a href="'.wl($ID,'idx='.rawurlencode($item['id'])).'" title="' . $item['id'] . '" class="idx_dir"' . $nofollow . '><strong>';
         $ret .= $base;
         $ret .= '</strong></a>';
     }else{
-- 
GitLab