如何更改javascript调用自然索引我的页面

时间:2016-07-04 16:04:48

标签: javascript php indexing google-crawlers

我有一个严重的问题索引我的一些网站页面甚至将它们放在站点地图上。我在Google论坛上问了一个人,他告诉我,通过查看我的某个页面的源代码,比如品牌页面(http://www.kelklope.com/marque/liste-des-marques-all.html),它不使用普通的linke,链接机制是一个JavaScript函数调用使搜索引擎很难自然地发现品牌页面。

这是文件的代码

<?php require_once('inc/header.php'); ?>
<body>
<script>
$('.category').click(function(){
        var idvalue = $(this).attr('id');
        if(idvalue =='category_all'){
            $("ul").hide();
            return false;
        }else{
            $("ul").hide();
            if($("ul."+idvalue).length){
                $("ul."+idvalue).show();
                $(this).addClass('categoryopen');
            }
        }
    });
    function changeProductByManufacture(categoryId,subCategoryId,MarqueId,MarqueName,sortBy,BoutiqueId){
        if(!sortBy || $.trim(sortBy) == '') sortBy = '';
        $(".flash").show();
        $(".flash").fadeIn(400);
        $(".flash").html("<img src=\"images/loader.gif\" />");
        if($.trim(MarqueId) == '' && $.trim(BoutiqueId) == ''){
            var MarqueId = $('#filterby').val();
            var dataString = 'categoryId='+categoryId+'&subcategoryId='+subCategoryId+'&marqueId='+MarqueId;
        }else{
            $(".category").removeClass("categorySel");
            $(".subcatspan").removeClass("subcategory_sel");
            $(".menu_sub_outer").hide();
            $("#marque_"+MarqueId).addClass("categorySel");
            var dataString = 'findmarqueId='+MarqueId;
            if(categoryId && $.trim(categoryId) != '')
                dataString = dataString + '&categoryId='+categoryId;
            if(BoutiqueId && $.trim(BoutiqueId) != '')
                dataString = dataString + '&findboutiqueId='+BoutiqueId;
                console.log(dataString);
            if(MarqueName && $.trim(MarqueName) != 'undefined' && $.trim(MarqueName) != '')
                var testUrl = "<?php echo SITEPATH.'marque/'; ?>"+MarqueName+"<?php echo '-'; ?>"+MarqueId+"<?php echo '.html'; ?>";
            if (typeof (history.pushState) != "undefined" && testUrl && $.trim(testUrl) != 'undefined'){
                objPage = 1;
                var obj = { Page: objPage, Url: testUrl };
                history.pushState(obj, obj.objPage, obj.Url);
            }
        }

        $.ajax({
            type: "POST",
            url: '<?php echo SITEPATH; ?>ajax/ajaxListProduit.php?rand=' + new Date().getTime(),
            data: dataString+'&sortBy='+sortBy,
            cache: false,
            success: function(result){
            $(".flash").hide();
                $("#list").html(result);
                setTimeout(function() {
                    $("html, body").scrollTop(50);
                }, 10);
            }
        });
        return false;
    }
    function changeProductByBoutique(categoryId,subCategoryId,boutiqueId,boutiqueName,sortBy){
        if(!sortBy || $.trim(sortBy) == '' || $.trim(sortBy) == 'undefined') sortBy = '';
        if(!boutiqueId || $.trim(boutiqueId) == '' || $.trim(boutiqueId) == 'undefined') MarqueId = '';
        $(".flash").show();
        $(".flash").fadeIn(400);
        $(".flash").html("<img src=\"images/loader.gif\" />");
        if($.trim(boutiqueId) == ''){
            var boutiqueId = $('#filterby').val();
            var dataString = 'categoryId='+categoryId+'&subcategoryId='+subCategoryId+'&boutiqueId='+boutiqueId;
        }else{
            $(".category").removeClass("categorySel");
            $(".subcatspan").removeClass("subcategory_sel");
            $(".menu_sub_outer").hide();
            $("#marque_"+boutiqueId).addClass("categorySel");
            var dataString = 'findboutiqueId='+boutiqueId;
            if(boutiqueName && $.trim(boutiqueName) != 'undefined' && $.trim(boutiqueName) != '')
                var testUrl = "<?php echo SITEPATH.'boutique/'; ?>"+boutiqueName+"-"+boutiqueId+"<?php echo '.html'; ?>";
            if (typeof (history.pushState) != "undefined" && testUrl && $.trim(testUrl) != 'undefined'){
                objPage = 1;
                var obj = { Page: objPage, Url: testUrl };
                history.pushState(obj, obj.objPage, obj.Url);
            }
        }
        $.ajax({
            type: "POST",
            url: '<?php echo SITEPATH; ?>ajax/ajaxListProduit.php?rand=' + new Date().getTime(),
            data: dataString+'&sortBy='+sortBy,
            cache: false,
            success: function(result){
            $(".flash").hide();
                $("#list").html(result);
                setTimeout(function() {
                    $("html, body").scrollTop(50);
                }, 10);
            }
        });
        return false;
    }
</script>
<div id="main">
    <?php require_once("inc/top.php"); ?>

    <div id="menu-left">
        <?php 
            if(isset($leftmarquefilters) && !empty($leftmarquefilters) && count($leftmarquefilters) >0){
                if(isset($leftmarquefilters['found_rows'])) unset($leftmarquefilters['found_rows']);
        ?>
            <div id="menu-cat">
                <div id="menu-bandeau" class="menu-bands">
                    <h1 class="rouge-degrade menu2"><?php echo 'Marques populaires'; ?></h1>
                    <div class="menu-ombre"> </div>
                    <div class="menu-lf ombre-shadow">  </div>
                    <div class="menu-rg sprite ombre-shadow coin-droite"> </div>
                </div>
                <?php
                    foreach($leftmarquefilters as $keys => $res) { ?>
                        <span>
                            <div class="outer-menu nosubmenu">
                                <a onClick="javascript:return changeProductByManufacture('','',<?php echo $res->id?>,'<?php echo mrpropreNoPlus($res->name) ?>');"  href="#" id="marque_<?php echo $res->id;?>" class="category <?php if(isset($_SESSION['MarqueListAll']) && $_SESSION['MarqueListAll'] == $res->id) echo 'categorySel'; ?>" title="<?php echo strtoupper($res->name);?>"> 
                                <div class="sel_sub">
                                    <span class="submenu_lf"></span>
                                    <div class="sel_md">
                                        <span class="leftmenu"><?php echo ( isset($res->name) && (strlen($res->name)>25) ? substr($res->name, 0,25).'...' : $res->name ) ;?></span>
                                        <span id="category_arrow_<?php echo $res->id;?>" class="sub_cat_indicator fright"> </span>
                                        <span class="arrow_down"></span>
                                    </div>
                                    <span class="submenu_rg"></span>
                                </div>
                            </a>
                            </div>
                        </span>
            <?php   } ?>
            </div>
        <?php }elseif(isset($leftboutiquefilters) && !empty($leftboutiquefilters) && count($leftboutiquefilters) >0){
                if(isset($leftboutiquefilters['found_rows'])) unset($leftboutiquefilters['found_rows']);
        ?>
            <div id="menu-cat">
                <div id="menu-bandeau" class="menu-bands">
                    <h1 class="rouge-degrade menu2"><?php echo 'Boutiques populaires'; ?></h1>
                    <div class="menu-ombre"> </div>
                    <div class="menu-lf ombre-shadow">  </div>
                    <div class="menu-rg sprite ombre-shadow coin-droite"> </div>
                </div>
                <?php
                    foreach($leftboutiquefilters as $keys => $res) { ?>
                        <span>
                            <div class="outer-menu nosubmenu">
                                <a onClick="javascript:return changeProductByBoutique('','',<?php echo $res->id?>,'<?php echo mrpropreNoPlus($res->name) ?>');"  href="#" id="boutique_<?php echo $res->id;?>" class="category <?php if(isset($_SESSION['BoutiqueAll']) && $_SESSION['BoutiqueAll'] == $res->id) echo 'categorySel'; ?>" title="<?php echo strtoupper($res->name);?>"> 
                                <div class="sel_sub">
                                    <span class="submenu_lf"></span>
                                    <div class="sel_md">
                                        <span class="leftmenu"><?php echo ( isset($res->name) && (strlen($res->name)>25) ? substr($res->name, 0,25).'...' : $res->name ) ;?></span>
                                        <span id="category_arrow_<?php echo $res->id;?>" class="sub_cat_indicator fright"> </span>
                                        <span class="arrow_down"></span>
                                    </div>
                                    <span class="submenu_rg"></span>
                                </div>
                            </a>
                            </div>
                        </span>
            <?php   } ?>
            </div>
        <?php } ?>
    </div>

    <div id="menu-main">
        <div id="list">
        </div>
        <span style="padding-left:23%;" class="flash"></span>
    </div>
    <div style="clear: both"></div>


</div>
<?php require_once("inc/footer.php") ; ?>
</body>
</html>
<script type="text/javascript">
$(document).ready(function(){
    changePaginationByListProduct(<?php echo (isset($_SESSION['listPageId']) ? $_SESSION['listPageId'] : '1');?>);
});
function changePaginationByListProduct(listPageId){
    <?php if(isset($_GET['marque']) && !empty($_GET['marque'])) { ?>
        var marque = '<?php echo (isset($_GET['marque']) ? $_GET['marque'] : '');?>';
        var dataString = 'listPageId='+ listPageId+'&marque='+marque;
    <?php }elseif(isset($_GET['boutique']) && !empty($_GET['boutique'])) { ?>
        var boutique = '<?php echo (isset($_GET['boutique']) ? $_GET['boutique'] : '');?>';
        var dataString = 'listPageId='+ listPageId+'&boutique='+boutique;
    <?php }else{ ?>
        var dataString = 'listPageId='+ listPageId;
    <?php } ?>
    $(".flash").show();
    $(".flash").fadeIn(400);
    $(".flash").html("<img src=\"images/loader.gif\" />");

    $.ajax({
        type: "POST",
        url: '<?php echo SITEPATH; ?>ajax/ajaxListAllProduit.php?rand=' + new Date().getTime(),
        data: dataString,
        cache: false,
        success: function(result){
        $(".flash").hide();
            $("#list").html(result);
            setTimeout(function() {
                $("html, body").scrollTop(50);
            }, 10);
        }
    });

    return false;
}
function submitFilterPaginationByList(){
    var listPerpage = $('#paginationPerpage').val();
    <?php if(isset($_GET['marque']) && !empty($_GET['marque'])) { ?>
        var marque = '<?php echo (isset($_GET['marque']) ? $_GET['marque'] : '');?>';
        var dataString = 'listPageId=1'+ '&listPerpage='+ listPerpage +'&marque='+marque;
    <?php }elseif(isset($_GET['boutique']) && !empty($_GET['boutique'])) { ?>
        var boutique = '<?php echo (isset($_GET['boutique']) ? $_GET['boutique'] : '');?>';
        var dataString = 'listPageId=1'+ '&listPerpage='+ listPerpage +'&boutique='+boutique;
    <?php }else{ ?>
        var dataString = 'listPageId=1'+ '&listPerpage='+ listPerpage ;
    <?php } ?>
     $(".flash").show();
     $(".flash").fadeIn(400);
     $(".flash").html("<img src=\"images/loader.gif\" />");
     $.ajax({
           type: "POST",
           url: '<?php echo SITEPATH; ?>ajax/ajaxListAllProduit.php?rand=' + new Date().getTime(),
           data: dataString,
           cache: false,
           success: function(result){
           $(".flash").hide();
                 $("#list").html(result);
                 setTimeout(function() {
                   $("html, body").scrollTop(50);
                 }, 10);
           }
      });

     return false;
}

0 个答案:

没有答案