N
N
Nadezhda Golovina2021-04-26 18:03:44
1C-Bitrix
Nadezhda Golovina, 2021-04-26 18:03:44

How to hide an Include Area from indexing?

Good afternoon.
In component_epilog.php (where the Product Characteristics were written by the developers of the Solution itself), the Include area component was added to display a block of text (one text for the entire Catalog in the Detailed product cards ).
SEO-shnik asks to hide it from indexing. Advise through AJAX to do. I do not want to fence extra crutches.
Is it possible to somehow get by with Bitrix? Or is it through AJAX?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nadezhda Golovina, 2021-04-27
@Golovina90

All the same, I did it through Ajax .
Because this option even hides a block from the file from the page code. And from indexing as well.
1. In the template where you need to put the desired block

<div id="extra"></div>
<script type="text/javascript">
$(function(){
  $.ajax({
    url: "ссылка-на-файл",
    dataType: "json",
    success:function(data){
      $("#extra").html(data.extra);
    }
  });
});
    
</script>

2. To the file itself to be output
<?php

$html = '
//Дополнительная инфа
//Дополнительная инфа
';

$data['extra'] = $html;
echo json_encode($data);
?>

Nuance
Someone may need to include the jquery library in the head of the site
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js?ver=5.5.1' id='jquery-js'></script>

But because of this, my styles flew off on the main page. Therefore, I did not add this line to the site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question