简体   繁体   English

Magento分层导航和SEO

[英]Magento Layered Navigation & SEO

I had a questions about Magento layered navigation & seo. 我对Magento分层导航和seo有疑问。

It appears our site is being indexed with urls that are relevant to attributes for example www.abc.com/exampleproduct?brand=69 我们的网站似乎正在使用与属性相关的网址编制索引,例如www.abc.com/exampleproduct?brand=69

This is creating tonnes of issues with duplicate content. 这会产生大量重复内容的问题。 Has anyone ever come accross something like this and is there any good solution for it. 有没有人来过这样的事情并且有任何好的解决方案。 Inchoo wrote a blog about it here: http://inchoo.net/online-marketing/magento-seo-how-to-handle-problems-caused-by-layered-navigation/ but it did not really come to a solid solution. Inchoo在这里写了一篇关于它的博客: http ://inchoo.net/online-marketing/magento-seo-how-to-handle-problems-caused-by-layered-navigation/但它并没有真正找到一个可靠的解决方案。

Thanks in advance, cm. 提前谢谢,cm。

You can copy your 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) 您可以将Head.php文件(/app/code/core/Mage/Page/Block/Html/Head.php)复制到本地目录(/ 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(is_array($appliedFilters) && count($appliedFilters) > 0){
                $this->_data['robots'] = "NOINDEX, FOLLOW";
            }
        }

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

PS Please also note that you should add some checks for objects exist. PS还请注意,您应该为对象添加一些检查。

Mage::app()->getFrontController()->getAction()->getFullActionName()

The solid and elegant solution for hiding layered navigation for crawlers and fix SEO issues caused by the huge number of layered navigation URLs would be using PRG Pattern . 用于隐藏爬虫的分层导航并修复由大量分层导航URL引起的SEO问题的坚实而优雅的解决方案将使用PRG Pattern

canonical, robots.txt, rel=nofollow etc. do not fully fix this issue or have at least some downsides or limitations. canonical,robots.txt,rel = nofollow等不能完全解决这个问题或至少有一些缺点或限制。

The PRG Pattern solution works like a charm, ie not changing the UX regarding Layered Navigation and 100% reliable in terms of preventing crawlers from wasting crawl budget on useless duplicate content URLs. PRG Pattern解决方案就像一个魅力,即不会改变有关分层导航的UX,并且在防止抓取工具浪费无用的重复内容URL上的爬行预算方面100%可靠。

Simply said, it's about replacing the GET request to a layered navigation/filter URL with a POST request (which search engine crawlers do not follow) before redirecting the user to the original layered navigation/filter URL. 简单地说,它是在将用户重定向到原始分层导航/过滤器URL之前,将GET请求替换为带有POST请求的分层导航/过滤器URL(搜索引擎爬虫不遵循)。

For further details and reading, please see 有关详细信息和阅读,请参阅

  1. Detailed explanation incl. 详细说明包括 sample request flow 样本请求流程
  2. Why robots.txt, rel=nofollow etc. are no satisfying solutions here 为什么robots.txt,rel = nofollow等不是令人满意的解决方案
  3. PRG Pattern Magento 2 Extension PRG Pattern Magento 2 Extension
  4. PRG Pattern Demo PRG模式演示

Try to use canonical url meta tag, and google, yahoo and other major search engine(s) will index only url specified by that meta tag. 尝试使用规范网址元标记,谷歌,雅虎和其他主要搜索引擎将只索引该元标记指定的网址。 For this purpose i recommend: Yoast extension 为此,我建议: Yoast扩展

In the video, there are some solutions like nofollow, Robots.txt and more. 在视频中,有一些解决方案,如nofollow,Robots.txt等。 You can take a look at the following suggestions too. 您也可以查看以下建议。

  1. You can use the canonical of respective product page/category page on all the dynamic/filter pages. 您可以在所有动态/过滤器页面上使用相应产品页面/类别页面的规范。

  2. If you are facing the issue, Google webmaster is reporting duplicate meta tags because all pages are indexed and they are containing meta tags of the main page. 如果您遇到此问题,Google网站站长会报告重复的元标记,因为所有网页都已编入索引,并且它们包含主页的元标记。 Then you can go for the dynamic meta tags. 然后你可以去动态元标记。

But using canonical of the main page is the best option. 但是使用主页的规范是最好的选择。 Hope these suggestions will help you! 希望这些建议对您有所帮助! :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM