cancel
Showing results for 
Search instead for 
Did you mean: 

Make filters seo friendly and add nofolow if more than 2 filteres are selected

Make filters seo friendly and add nofolow if more than 2 filteres are selected

Hi. i'm new to magento and i need to make filters url more seo friendly. ex : http://website.com/blugi-dama?culoare=13 to http://website.com/blugi-dama/color/red

also, i need to add nofolow tag if more than 2 filters are selected.  any idea or module? thanks 

5 REPLIES 5

Re: Make filters seo friendly and add nofolow if more than 2 filteres are selected

Hi @iubbbbbbb,

 

You won't get it using Magento OOTB but there are several paid modules that can help you.

Maybe you can start looking at https://marketplace.magento.com/

Re: Make filters seo friendly and add nofolow if more than 2 filteres are selected

if someone need fix..

for nofollow:

copy Head.php file (/app/code/core/Mage/Page/Block/Html/Head.php) to the local directory (/app/code/local/Mage/Page/Block/Html/Head.php)

Here is how to implement modification of the new file:

public function getRobots()
    {
        if (empty($this->_data['robots'])) {
            $this->_data['robots'] = Mage::getStoreConfig('design/head/default_robots');
        }

        //Added NOINDEX, FOLLOW for category page with filter(s)
        if(Mage::app()->getFrontController()->getAction()->getFullActionName() == 'catalog_category_view'){
            $appliedFilters = Mage::getSingleton('catalog/layer')->getState()->getFilters();

            //var_dump($appliedFilters);  //<-- uncomment and see filters as array in page source code in meta robots tag.

            if(count($appliedFilters) > 2){
                $this->_data['robots'] = "NOINDEX, FOLLOW";
            }
        }

        return $this->_data['robots'];
    }

url filters fixed with this module https://github.com/Flagbit/Magento-FilterUrls

 

Re: Make filters seo friendly and add nofolow if more than 2 filteres are selected

You can use SEO Meta tags templates module by FME. It allows you to automatically generate SEO friendly Meta titles, description, keywords & custom URLs. 

 

Check out more features here https://www.fmeextensions.com/meta-tags-generator-magento-2-extension.html

 

To add NoIndex NoFollow tag to any number of products, categories or CMS pages, use this extension. It allows you to use any combination of Index Follow tag.

https://www.fmeextensions.com/no-index-no-follow-tag-magento-2-extension.html

 

If you want an all-in-one SEO module, use the following. It will completely remove your SEO workload & cost. This module combines 7 small SEO extensions and will automate the process of generating SEO meta tags, canonical tags, Google rich snippets, NoIndex NoFollow tags, Image alt tags, Hreflang tag, and XML & HTML sitemap. 

https://www.fmeextensions.com/ultimate-seo-toolkit-for-magento-2.html

Re: Make filters seo friendly and add nofolow if more than 2 filteres are selected

Thanks for sharing the solution! To address the "nofollow" issue, copying the Head.php file and implementing the modification is a smart move. Your additional code snippet for handling the "NOINDEX, FOLLOW" on category pages with filters is a thoughtful touch.

 

For those looking to enhance their SEO strategy, consider staying updated on the latest SEO updates,  including valuable updates from reliable sources like "Search Engine Land." Additionally, for URL filters, the module from Flagbit can be a handy resource. Keep optimizing!

#latestseoupdates #SEOtips

Re: Make filters seo friendly and add nofolow if more than 2 filteres are selected

 

SEO-Friendly URLs

Using Magento's Built-in URL Rewrites:

Magento allows URL rewrites, but for custom filter URLs, you might need a module or custom development. You can try the following modules:

  1. SEO Suite Ultimate by Mageworx:

    • This extension helps with SEO-friendly URLs for filters and layered navigation.
    • Improved Layered Navigation by Amasty:

      • Offers SEO-friendly URLs and advanced filtering options.

        Custom Development: If you prefer custom development, you'll need to create URL rewrite rules and customize your layered navigation URLs. This requires a good understanding of Magento's routing and URL management.

        2. Adding Nofollow Tag

        Using a Module:

        1. SEO Suite Ultimate by Mageworx:

          • This module might include the ability to add nofollow tags based on conditions.
          • Improved Layered Navigation by Amasty:

            • Check if this module provides the functionality to add nofollow tags when more than 2 filters are selected.

              Custom Development:

              You can achieve this by customizing the theme or module:

              1. Create an Observer:

                • Listen to the event that triggers when a filter is applied.
                • Modify the Header:

                  • In your observer, add logic to check the number of filters applied and add the nofollow tag if the condition is met.

                    Example Custom Code for Nofollow Tag:

                    1. Create an Observer:
                      • Create a custom module if you don't have one.
                      • Add an observer for the event controller_action_layout_render_before.

                         

                        php
                        Copy code
                        // app/code/Vendor/Module/etc/events.xml <event name="controller_action_layout_render_before"> <observer name="add_nofollow_to_filters" instance="Vendor\Module\Observer\AddNofollow"/> </event>

                         

                         
                        1. Create the Observer Class:

                           

                          php
                          Copy code
                          // app/code/Vendor/Module/Observer/AddNofollow.php namespace Vendor\Module\Observer; use Magento\Framework\Event\ObserverInterface; use Magento\Framework\Event\Observer; class AddNofollow implements ObserverInterface { public function execute(Observer $observer) { $layout = $observer->getEvent()->getLayout(); $filters = // Logic to count the number of applied filters if (count($filters) > 2) { $layout->getUpdate()->addHandle('add_nofollow'); } } }

                           

                           
                          1. Add Nofollow in Layout XML:

                             

                            xml
                            Copy code
                            <!-- app/code/Vendor/Module/view/frontend/layout/default.xml --> <layout> <handle id="add_nofollow"> <referenceContainer name="head"> <block class="Magento\Framework\View\Element\Template" name="custom.nofollow" template="Vendor_Module::nofollow.phtml"/> </referenceContainer> </handle> </layout>

                             

                             
                            1. Create the Template File:

                               

                              php
                              Copy code
                              <!-- app/code/Vendor/Module/view/frontend/templates/nofollow.phtml --> <meta name="robots" content="noindex, nofollow"/>
                               

                              Modules to Consider:

                              1. Mageworx SEO Suite Ultimate: