Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2016
    Location
    Marietta GA
    Posts
    84
    Plugin Contributions
    0

    Default Add Robots to Category Meta

    Hello, I'd like to remove one product category from google indexing. I've read posts here about how to do so via the robots.txt file. However, according to Google using robots.txt file is not the way to go. (https://developers.google.com/search...block-indexing). Bottom line, Goog, and others have to crawl a page to see a meta tag to honor that it not be indexed.

    Under category meta, there are two tags available: keywords and description. I would like to add a third meta tag - robots. And in that tag, I would put noindex, follow. Using developer toolkit, I found two files where " Categories Meta Tags Definitions" are. I've thought to add lines to them for robot meta as shown below, simply following the pattern of the existing meta tags fields. However upon refreshing my category view, the Robots meta tag doesn't show up. So I'm apparently missing something else I need to create a Robots meta tag for categories. Any suggestions on how I could accomplish this?

    /public_html/<admindir>/includes/languages/english/categories.php

    added the line:

    define('TEXT_EDIT_CATEGORIES_META_TAGS_ROBOTS', 'Robots:');

    added the line:

    /public_html/<admindir/includes/languages/english/lang.categories.php

    'TEXT_EDIT_CATEGORIES_META_TAGS_ROBOTS' => 'Robots:',

    Thanks!

  2. #2
    Join Date
    Mar 2016
    Location
    Marietta GA
    Posts
    84
    Plugin Contributions
    0

    Default Re: Add Robots to Category Meta

    Did some more searching of the forums with different terms on my issue, found a 2006 post an exactly the same question - https://www.zen-cart.com/showthread....ther-meta-tags.

    Also in another post (darn I didn't save the url) someone mentioned a "meta_tags.php" file, which I didn't come across in my search, above. So I went looking again with Dev Tool Kit . . . no joy. IS there such a file I just didn't search for quite right? Not finding with a search using my FTP client, either.

  3. #3
    Join Date
    Mar 2016
    Location
    Marietta GA
    Posts
    84
    Plugin Contributions
    0

    Default Re: Add Robots to Category Meta

    welp, I finally found it -- /includes/modules/meta_tags.php. But, gad, "define" is in there only 94 times Got no idea how I would edit it correctly to add a meta tag for robots. Please help?

  4. #4
    Join Date
    Mar 2016
    Location
    Marietta GA
    Posts
    84
    Plugin Contributions
    0

    Default Re: Add Robots to Category Meta

    any guidance on editing the /includes/modules/meta_tags.php to add a new metatag would be appreciated. Thx

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,942
    Plugin Contributions
    96

    Default Re: Add Robots to Category Meta

    Quote Originally Posted by greg_beyer View Post
    any guidance on editing the /includes/modules/meta_tags.php to add a new metatag would be appreciated. Thx
    Using the template-override system (https://docs.zen-cart.com/user/templ.../#introduction), you would first copy /includes/modules/meta_tags.php to /includes/modules/YOUR_TEMPLATE/meta_tags.php, where YOUR_TEMPLATE is the name of the site's current template.

    Next, you'd edit that template-override copy of a Zen Cart core-file, adding the highlighted section to the bottom of the file:
    Code:
    ...
    
    $zco_notifier->notify('NOTIFY_MODULE_META_TAGS_OVERRIDE', $metatag_page_name, $meta_tags_over_ride, $metatags_title, $metatags_description, $metatags_keywords);
    
    // meta tags override due to 404, missing products_id, cPath or other EOF issues
    if ($meta_tags_over_ride === true) {
        zen_define_default('META_TAG_TITLE', $metatags_title);
        zen_define_default('META_TAG_DESCRIPTION', $metatags_description);
        zen_define_default('META_TAG_KEYWORDS', $metatags_keywords);
    }
    
    // -----
    // Tell all search engines not to index the specified category (13 for this example)
    //
    if (isset($_GET['cPath']) && (int)$_GET['cPath'] === 13) {
    ?>
    <meta name="robots" content="noindex">
    <?php
    }
    
    // This should be last line of the script:
    $zco_notifier->notify('NOTIFY_MODULE_END_META_TAGS');

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg