Php 谷歌是否爬网/索引;计算的;还是原始html源代码?

Php 谷歌是否爬网/索引;计算的;还是原始html源代码?,php,wordpress,search,Php,Wordpress,Search,我有一个独特的情况,我有几个页面在多个页面中“分页”(通过WordPress的“下一页”功能)。相同的内容,分布在两个或多个页面上,如下所示: http://mysite.com/mypage/ http://mysite.com/mypage/2 http://mysite.com/mypage/3 <title>mypage</title> <title>mypage (page 2)</title> <title>mypage

我有一个独特的情况,我有几个页面在多个页面中“分页”(通过WordPress的“下一页”功能)。相同的内容,分布在两个或多个页面上,如下所示:

http://mysite.com/mypage/
http://mysite.com/mypage/2
http://mysite.com/mypage/3
<title>mypage</title>
<title>mypage (page 2)</title> 
<title>mypage (page 3)</title>
<details class="myEl" open="open">
    <summary>In this article</summary>
    <ol>
        <li><a href="post-slug/">Introduction</a></li>
        <li><a href="post-slug/2/" class="active">Title for the second page</a></li>
        <li><a href="post-slug/3/">Title for the third page</a></li>
    </ol>
</details>
因此,页面本身有一个html页面标题标签
我的页面
,但由于它分布在多个页面上,我必须创建脚本,为每个页面添加唯一的html标题标签,以便让谷歌为它们编制索引

要做到这一点,我使用

$exploded = explode("/",$_SERVER['REQUEST_URI']);

if( is_numeric( $exploded[sizeof($exploded)-2] ) && !is_archive())
{
    $title = $title." (Page ".$exploded[sizeof($exploded)-2].")";
}
这将为每个“分页”页面创建唯一的页面标题,如下所示:

http://mysite.com/mypage/
http://mysite.com/mypage/2
http://mysite.com/mypage/3
<title>mypage</title>
<title>mypage (page 2)</title> 
<title>mypage (page 3)</title>
<details class="myEl" open="open">
    <summary>In this article</summary>
    <ol>
        <li><a href="post-slug/">Introduction</a></li>
        <li><a href="post-slug/2/" class="active">Title for the second page</a></li>
        <li><a href="post-slug/3/">Title for the third page</a></li>
    </ol>
</details>
mypage
mypage(第2页)
mypage(第3页)
现在,我遇到了这样一种情况,我试图对此进行一些改进,以更具描述性的标题替换(第X页)

因此,在我的标记中,当页面按如下方式分页时,我包含了一个html“details”元素,其中包含页面的目录,如下所示:

http://mysite.com/mypage/
http://mysite.com/mypage/2
http://mysite.com/mypage/3
<title>mypage</title>
<title>mypage (page 2)</title> 
<title>mypage (page 3)</title>
<details class="myEl" open="open">
    <summary>In this article</summary>
    <ol>
        <li><a href="post-slug/">Introduction</a></li>
        <li><a href="post-slug/2/" class="active">Title for the second page</a></li>
        <li><a href="post-slug/3/">Title for the third page</a></li>
    </ol>
</details>

本文
  • 为了尝试将TOC的标题复制到title标记中(替换“Page X”标题),我尝试使用这个jQuery脚本(它可以完美地更改“computed”源的标题):

    
    jQuery(文档).ready(函数(){
    var title=jQuery('.myEl').find('a.active').text();
    jQuery(“标题”)。文本(标题);
    });
    
    但是,当我使用测试这些页面时,标题与“(Page X)”语法保持不变。这就好像谷歌正在解析原始的html源代码,而不是计算的源代码


    这可以确认吗?

    虽然有些爬虫程序能够运行JS并访问呈现的页面,但大多数爬虫程序不能。因此,他们所有的信息都基于原始HTML,并使用呈现页面(如果可用)来检测blackhat SEO策略(隐藏关键字填充、链接更改、js重定向等)


    如果你想让谷歌(和其他搜索引擎)找到你改进过的标题,你必须以HTML格式发送,而不是在页面加载后修改它。

    因此,听起来你的意思是,他们能够解析计算/呈现的页面,但他们仅将其用于检测错误行为,而不是用于索引目的。对吗?答对了。和