我的问题是,谷歌没有索引我的网站,它已经启动和运行了5个星期。
这并不是说它没有索引我的内部页面,而是,它没有索引网站本身的。
当你在谷歌上键入"xyz“作为搜索关键字时,我的网站"ww.xyz.com”就被完全忽略了。
该网站是ajax驱动的,这是我的配置:
我在服务器根文件夹中有一个robot.txt:
User-agent: *
Disallow: /admin/
Sitemap: http://www.xyz.com/sitemap.xml我在服务器根文件夹中有一个sitemap.xml:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="..." xmlns:xsi="..." xsi:schemaLocation="...">
<url><loc>http://www.xyz.com/</loc></url>
<url><loc>http://www.xyz.com/index.php?action=link1</loc></url>
<url><loc>http://www.xyz.com/index.php?action=link2</loc></url>
</urlset>索引页如下所示:
<!doctype html>
<html lang="fr">
<head>
<title>xyz</title>
<meta http-equiv= "content-type" content="text/html;charset=utf-8">
<meta http-equiv= "Content-Language" content="fr" >
<meta name = "fragment" content="!">
<meta name = "google" content="notranslate">
<meta name = "robots" content="index,follow">
<meta name = "Description" content="...">
<meta name = "Keywords" content="...">
</head>
<body>
<ul id="menu>
<li id="mylink1">
<a href="index.php?action=link1">Link 1</a>
</li>
<li id="mylink2">
<a href="index.php?action=link2">Link 2</a>
</li>
</ul>
<div id="content">
<?php include('ajax.php');?>
</div>
</body>
</html>"ajax.php“文件如下所示:
<script type="text/javascript">
$('#link1').click(function(e)
{
e.preventDefault();
$.ajax({
type:"POST",
url:"includes/page1.php,
data:"action=link1",
complete:function(data){$('#content').html(data.responseText);}
});
$('#link2').click(function(e)
{
e.preventDefault();
$.ajax({
type:"POST",
url:"includes/page2.php,
data:"action=link2",
complete:function(data){$('#content').html(data.responseText);}
});
});
</script>假设我们的目标是“include/ page1.php”,下面是page1.php内容:
<?php
if($_POST['action']=='link1')
{
//show the content
...
}
?>如您所见,"index.php“上的href url没有用,因为它们被javascript中的"e.preventDefault();”关闭。
所有工作都是由“$(‘#link1 1’).click(函数(E){.})”完成的。
而且,由于#内容是通过使用“$(‘#content’).html(data.responseText)”动态传递的,所以我认为存在一个DOM问题,使得谷歌机器人无法爬行这个网站。
我读过这个google帮助页面,它描述了如何使ajax驱动的网站google友好:
https://developers.google.com/webmasters/ajax-crawling/docs/getting-started
问题是,他们似乎解释了如何使url使用散列可由谷歌机器人爬行,但我的网站不使用哈希在链接中,所以我没有真正了解我应该做什么,使我的网站由谷歌索引。
任何帮助都将不胜感激。
发布于 2013-03-21 17:20:58
你有两个选择:
https://stackoverflow.com/questions/15554037
复制相似问题