aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2007-01-09 01:30:02 +0000
committerrvelices <rv-github@modusoptimus.com>2007-01-09 01:30:02 +0000
commit1e7b286faaf29ae55b60a0bd28b8f5ce74ab6654 (patch)
tree596056b7e67c61841a6acd1faa1beff65b6bf64f /include
parentf68903ec234fe7d76cddbbaa99fb0096d329582c (diff)
feature 606: search engine spider restrictions (meta robots)
git-svn-id: http://piwigo.org/svn/trunk@1703 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r--[-rwxr-xr-x]include/menubar.inc.php12
-rw-r--r--include/page_header.php16
-rw-r--r--include/section_init.inc.php39
3 files changed, 52 insertions, 15 deletions
diff --git a/include/menubar.inc.php b/include/menubar.inc.php
index d5535ca12..a57db5ea7 100755..100644
--- a/include/menubar.inc.php
+++ b/include/menubar.inc.php
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $Id$
@@ -187,7 +187,8 @@ $template->assign_block_vars(
array(
'URL' => get_root_url().'random.php',
'TITLE' => $lang['random_cat_hint'],
- 'NAME' => $lang['random_cat']
+ 'NAME' => $lang['random_cat'],
+ 'REL'=> 'rel="nofollow"'
));
// recent pics
@@ -196,7 +197,7 @@ $template->assign_block_vars(
array(
'URL' => make_index_url(array('section' => 'recent_pics')),
'TITLE' => $lang['recent_pics_cat_hint'],
- 'NAME' => $lang['recent_pics_cat']
+ 'NAME' => $lang['recent_pics_cat'],
));
// recent cats
$template->assign_block_vars(
@@ -204,7 +205,7 @@ $template->assign_block_vars(
array(
'URL' => make_index_url(array('section' => 'recent_cats')),
'TITLE' => $lang['recent_cats_cat_hint'],
- 'NAME' => $lang['recent_cats_cat']
+ 'NAME' => $lang['recent_cats_cat'],
));
// calendar
@@ -221,7 +222,8 @@ $template->assign_block_vars(
)
),
'TITLE' => $lang['calendar_hint'],
- 'NAME' => $lang['calendar']
+ 'NAME' => $lang['calendar'],
+ 'REL'=> 'rel="nofollow"'
)
);
//--------------------------------------------------------------------- summary
diff --git a/include/page_header.php b/include/page_header.php
index 2a82d5e4b..8b0d69d2d 100644
--- a/include/page_header.php
+++ b/include/page_header.php
@@ -2,10 +2,10 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
-// | file : $RCSfile$
+// | file : $Id$
// | last update : $Date$
// | last modifier : $Author$
// | revision : $Revision$
@@ -71,6 +71,18 @@ if (count($header_notes) > 0)
}
}
+if ( !empty($page['meta_robots']) )
+{
+ $template->assign_block_vars('head_element',
+ array(
+ 'CONTENT' =>
+ '<meta name="robots" content="'
+ .implode(',', array_keys($page['meta_robots']))
+ .'">'
+ )
+ );
+}
+
// refresh
if ( isset( $refresh ) and intval($refresh) >= 0
and isset( $url_link ) and isset( $redirect_msg ) )
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index 2911d60cc..3e2e39187 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $Id$
@@ -247,7 +247,7 @@ else if ('list' == $tokens[$next_token])
$next_token++;
$page['list'] = array();
-
+
// No pictures
if (empty($tokens[$next_token]))
{
@@ -350,9 +350,9 @@ if ('categories' == $page['section'])
'cat_commentable' => $result['commentable'],
'cat_id_uppercat' => $result['id_uppercat'],
'uppercats' => $result['uppercats'],
- 'title' =>
+ 'title' =>
get_cat_display_name($result['name'], '', false),
- 'thumbnails_include' =>
+ 'thumbnails_include' =>
(($result['nb_images'] > 0) or (isset($page['flat_recent_cat'])))
? 'include/category_default.inc.php'
: 'include/category_cats.inc.php'
@@ -362,7 +362,7 @@ if ('categories' == $page['section'])
else
{
$page['title'] = $lang['no_category'];
- $page['thumbnails_include'] =
+ $page['thumbnails_include'] =
(isset($page['flat_recent_cat']))
? 'include/category_default.inc.php'
: 'include/category_cats.inc.php';
@@ -373,11 +373,11 @@ if ('categories' == $page['section'])
$page['title'] = $lang['recent_pics_cat'].' : '.$page['title'] ;
}
- if
+ if
(
(!isset($page['chronology_field'])) and
(
- (isset($page['category'])) or
+ (isset($page['category'])) or
(isset($page['flat_recent_cat']))
)
)
@@ -458,7 +458,7 @@ SELECT distinct image_id
// special sections
else
{
- $forbidden =
+ $forbidden =
get_sql_condition_FandF
(
array
@@ -729,5 +729,28 @@ SELECT id,file
}
}
+// add meta robots noindex, nofollow to avoid unnecesary robot crawls
+$page['meta_robots']=array();
+if ( isset($page['chronology_field']) or isset($page['flat_recent_cat'])
+ or 'list'==$page['section'] or 'recent_pics'==$page['section'] )
+{
+ $page['meta_robots']=array('noindex'=>1, 'nofollow'=>1);
+}
+elseif ('tags' == $page['section'])
+{
+ if ( count($page['tag_ids'])>1 )
+ {
+ $page['meta_robots']=array('noindex'=>1, 'nofollow'=>1);
+ }
+}
+elseif ('recent_cats'==$page['section'])
+{
+ $page['meta_robots']['nofollow']=1;
+}
+if ( $filter['enabled'] )
+{
+ $page['meta_robots']['noindex']=1;
+}
+
trigger_action('loc_end_section_init');
?> \ No newline at end of file