D
D
Denis2021-08-31 00:46:51
WordPress
Denis, 2021-08-31 00:46:51

Wordpress close rubric from indexing on homepage?

Welcoming colleagues, please help out, There is a site on Wordpress https://residenciaespanola.ru/ , 2 categories and a blog (all articles) are displayed on the main page from the heading, how can I close them from indexing on the main page? what not to close all page and these 3 categories??? I will be grateful.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artem Zolin, 2021-08-31
@Fetfurmoz

Do you really understand the meaning of "close from indexing"? There are two ways to close specific pages from indexing:

  1. At the beginning of the html document, add the robots meta tag with the noindex value
  2. Write the rules for search robots in the robots.txt file

Both options will prevent search robots from indexing pages. And this is still a recommendation, if the search engine finds the content useful, it can ignore the specified rules
There is also a tag <noindex>...</noindex>, Google ignores it
You can prevent the robot from following links by specifying rel="nofollow" , but it will still find these pages and index them if indexing is not allowed

D
Denis, 2021-08-31
@Fetfurmoz

Here is an example category 612dd7905c6f1247335408.png
Here is the code that displays it

<?php
   // параметры по умолчанию
   $posts = get_posts( array(
   'numberposts' => 5,
   'category'    => 12,
   'orderby'     => 'date',
   'order'       => 'DESC',
   'post_type'   => 'post',
   'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
   ) );

   foreach( $posts as $post ){
    setup_postdata($post);
?>
<article class="whant-container__box">
    <?php the_post_thumbnail(); ?>
    <a href="<?php the_permalink(); ?>" class="whant-article-box whant-article--big box-light-fon">
        <div class="whant-content">
            <div class="h4 whant-content__title">
                <?php trim_title_chars(57, '...'); ?>
            </div>
            <p>
                <?php echo wp_trim_words( get_the_excerpt(), 75 ); ?>
            </p>
        </div>
    </a>
</article>
<?php
}

wp_reset_postdata(); // сброс
?>

How can I close it from indexing? if at the beginning of the html document I set the robots meta tag with the value noindex , then the whole page will close, and I only need to close this block on the main page from the robot

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question