【问题标题】:Angular JS Application doesn't crawl and index in Google?Angular JS 应用程序不会在 Google 中抓取和索引?
【发布时间】:2017-03-28 01:55:00
【问题描述】:

我已设置好一切,以便在 Google 搜索引擎中抓取我的 Angular JS 应用程序。

Website url :http://templatic.net/test/

我已经为 Angular JS 应用程序设置了 html5Mode,还设置了为特定请求生成 html 快照。

所以当谷歌爬虫来的时候,它会得到我的网站网址,比如http://templatic.net/test/?_escaped_fragment_=/job_category/mobile for http://templatic.net/test/job_category/mobile

但是当我去 Google 网站管理员并点击 Fetch as Google 以获取特定链接时,它不会返回特定 URL 的 HTML 快照。

我还在 Google 网站管理员工具中添加了 sitemap.xml,它已被接受,但没有一个链接被编入索引。

我不知道我做错了什么。

【问题讨论】:

    标签: javascript angularjs


    【解决方案1】:

    我遇到了类似的问题。我正在使用 iis 服务器。我通过检查其用户代理捕获 google 爬虫并重定向到另一个服务器渲染应用程序来解决问题,并在该应用程序中返回元标记。

    这是我的 iis 重定向规则

    <rule name="Imported Rule 1" stopProcessing="true">
              <match url="(.*)" ignoreCase="false" />
              <conditions>
                <add input="{HTTP_USER_AGENT}" pattern="(facebookexternalhit)|(Twitterbot)|(Pinterest)|(Googlebot)|(developers.google.com)|(LinkedInBot)|(WhatsApp)" />
              </conditions>
              <action type="Redirect" url="https://myredirectionapp/snapshot?qp={R:1}" appendQueryString="false" />
            </rule>
    

    【讨论】:

    • 我正在使用 apache 服务器并在 _escaped_fragment_ 等参数中捕获 google 爬虫,我已将其重定向到快照网址,但我认为它无法正常工作,因此未在 google 中编入索引
    • 而不是检查 escaped_fragment 检查请求中的用户代理
    • 我不知道 apache 的语法。我认为你可以通过在 apache 上找到重写功能来做到这一点
    • RewriteEngine On RewriteCond %{HTTP_USER_AGENT} Googlebot|bingbot|baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator [NC,OR] RewriteCond %{QUERY_STRING} ^_escaped_fragment_=(.*?)\/*$ RewriteRule ^(.*)$ /snapshots/$1.html [R=301,QSD] 我已经在.htaccess 中为 apache 添加了这个,但没有工作
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-29
    • 2017-03-31
    • 1970-01-01
    相关资源
    最近更新 更多