Zen Cart Logo
Forums / Bug Reports / Robots_pages_to_skip

Robots_pages_to_skip

Views: 4,226

Results 1 to 2 of 2
25 Dec 2022, 3:13 PM
#1
yesaul avatar

yesaul

New Zenner

Join Date:
Apr 2011
Location:
Espoo, Finland
Posts:
71
Plugin Contributions:
0

Robots_pages_to_skip

Hello,

In earlier versions of ZC, definition of 'ROBOTS_PAGES_TO_SKIP' was in 'meta_tags.php' file and looked like:

define('ROBOTS_PAGES_TO_SKIP','login,logoff,create_account,account,account_edit,account_history...

(Important: string with no spaces, etc)

Starting from v158 this definition is moved to 'extra_configures/robots_pages_to_skip.php' file and has formatted outlook:

/**
 * list of pages that should not be indexed by robots
 */

define('ROBOTS_PAGES_TO_SKIP', '
    account,
    account_edit,
    account_history,
    account_history_info,
    ...

The problem is in spaces added - appropriate code in 'functions/html_output.php' (and also 'common/html_header.php') must now be modified from:

 if (defined('ROBOTS_PAGES_TO_SKIP') && in_array($page, explode(",", constant('ROBOTS_PAGES_TO_SKIP')))

to something like:

 if (defined('ROBOTS_PAGES_TO_SKIP') && in_array($page, explode(",", str_replace([" ", "\n"], ['', ''], ROBOTS_PAGES_TO_SKIP)))

otherwise it seems 'in_array' function won't be working correctly.

Sorry, if i understand something wrong...