СЕО для сайта основа

HTML

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">

    <meta property="og:title" content="Майнинговые решения">
    <meta property="og:site_name" content="danilsmg.ru">
    <meta property="og:url" content="<?php echo get_home_url(); ?>">
    <meta property="og:description" content="Подход, ориентированный на интересы клиента: Сервисное обслуживание, Размещение, Продажа">
    <meta property="og:image" content="<?php echo get_home_url(); ?>/wp-content/themes/shablon/img/ceo-cover.png">
    <meta name="twitter:image:src" content="<?php echo get_home_url(); ?>/wp-content/themes/shablon/img/ceo-cover.png">

    <link rel="shortcut icon" href="<?php echo get_home_url(); ?>/favicon.png" type="image/png">
    <link rel="shortcut icon" href="<?php echo get_home_url(); ?>/favicon.ico" type="image/x-icon">
    <link rel="shortcut icon" href="<?php echo get_home_url(); ?>/favicon.svg" type="image/svg">
    
    <link rel="stylesheet/less" href="<?php bloginfo( 'template_url' ); ?>/less/style.less?ver=2006241112">

    <?php $queried_object = get_queried_object(); ?>
    
    <?php if (is_post_type_archive('products')) : ?>
        <?php if (get_field('title', 31)) : ?>
            <title><?php the_field('title', 31); ?></title>
        <?php else : ?>
            <title><?php echo wp_get_document_title(); ?></title>
        <?php endif; ?>
        <meta name="description" content="<?php the_field('description', 31); ?>">
        <meta name="keywords" content="<?php the_field('keywords', 31); ?>">
        <?php if( get_field('скрыть_от_индексации_страницу', 31) ): ?>
        <meta name="robots" content="noindex, nofollow" />
        <?php endif; ?>
        
    <?php else : ?>
        <?php if (get_field('title', $queried_object)) : ?>
            <title><?php the_field('title', $queried_object); ?></title>
        <?php else : ?>
            <title><?php echo wp_get_document_title(); ?></title>
        <?php endif; ?>
        <meta name="description" content="<?php the_field('description', $queried_object); ?>">
        <meta name="keywords" content="<?php the_field('keywords', $queried_object); ?>">
        <?php if( get_field('скрыть_от_индексации_страницу', $queried_object) ): ?>
        <meta name="robots" content="noindex, nofollow" />
        <?php endif; ?>
    <?php endif; ?>

    <?php wp_head(); ?>
</head>

Плагин для sitemaps.xml — Google XML Sitemaps (Автор — Auctollo)

Микроразметка

page

<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
    "itemListElement": [{
        "@type": "ListItem",
        "position": 1,
        "item": {
        "@id": "<?php echo get_home_url(); ?>",
        "name": "Главная"
        }
    },
    {
        "@type": "ListItem",
        "position": 2,
        "item": {
        "@id": "<?php $current_page_url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; echo esc_url($current_page_url); ?>",
        "name": "<?php the_title(); ?>"
        }
    }]
    }
</script>

archive

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [{
    "@type": "ListItem",
    "position": 1,
    "item": {
      "@id": "<?php echo get_home_url(); ?>",
      "name": "Главная"
    }
  },
  {
    "@type": "ListItem",
    "position": 2,
    "item": {
      "@id": "<?php $current_page_url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; echo esc_url($current_page_url); ?>",
      "name": "Каталог"
    }
  }]
}
</script>

taxonomy

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [{
    "@type": "ListItem",
    "position": 1,
    "item": {
        "@id": "<?php echo get_home_url(); ?>",
      "name": "Главная"
    }
  },{
    "@type": "ListItem",
    "position": 2,
    "item": {
      "@id": "<?php echo get_home_url(); ?>/products/",
      "name": "Оборудование"
    }
  },{
    "@type": "ListItem",
    "position": 3,
    "item": {
      "@id": "<?php $current_page_url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; echo esc_url($current_page_url); ?>",
      "name": "<?php single_cat_title(); ?>"
    }
  }]
}
</script>

single-product

<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
    "itemListElement": [{
        "@type": "ListItem",
        "position": 1,
        "item": {
        "@id": "<?php echo get_home_url(); ?>",
        "name": "Главная"
        }
    }
    ,{
        "@type": "ListItem",
        "position": 2,
        "item": {
        "@id": "<?php echo get_home_url(); ?>/products/",
        "name": "Каталог"
        }
    }
    
    <?php
        $term = get_the_terms(get_the_ID(), 'productscat'); // Получаем текущую запись
        if ($term) :
        $term = array_shift($term); // Получаем только первый термин из списка (если запись может иметь несколько терминов)
        $taxonomy = $term->taxonomy; // Получаем текущую таксономию
        $ancestors = get_ancestors($term->term_id, $taxonomy); // Получаем предков текущего термина
        $ancestors = array_reverse($ancestors); // Меняем порядок массива на обратный
    ?>
    <?php if (!empty($ancestors)) : ?>
    <?php foreach ($ancestors as $ancestor) : ?>
    ,{
        "@type": "ListItem",
        "position": 3,
        "item": {
        "@id": "<?php $ancestor_term = get_term_by('term_id', $ancestor, $taxonomy); echo get_term_link($ancestor_term); ?>",
        "name": "<?php echo $ancestor_term->name; ?>"
        }
    }
    <?php endforeach; ?>
    <?php endif; ?>    
    <?php endif; ?>

    ,{
        "@type": "ListItem",
        "position": 4,
        "item": {
        "@id": "<?php echo get_term_link($term); ?>",
        "name": "<?php echo $term->name; ?>"
        }
    },
    {
        "@type": "ListItem",
        "position": 5,
        "item": {
        "@id": "<?php $current_page_url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; echo esc_url($current_page_url); ?>",
        "name": "<?php the_title(); ?>"
        }
    }]
    }
</script>

разметка single-product

<div class="page-content page-product-single" itemscope itemtype="https://schema.org/Product">
    <img itemprop="image" src=""> <!--либо-->
    <meta itemprop="image" content="<?php echo $image['sizes']['large']; ?>"> <!--либо-->
    <span itemprop="name"><h1><?php the_title(); ?></h1></span>
    <div class="entrytext" itemprop="description"></div>

    <div itemprop="offers" itemscope itemtype="https://schema.org/Offer">
        <meta itemprop="price" content="<?php the_field('цена'); ?>">
        <meta itemprop="priceCurrency" content="RUB">
        <link itemprop="availability" href="http://schema.org/InStock">
        <link itemprop="url" href="<?php the_permalink(); ?>">
    </div>
    
    <!-- Информация о бренде -->
    <div itemprop="brand" itemscope itemtype="https://schema.org/Brand">
        <meta itemprop="name" content="Liechty">
    </div>
</div>

product-item

<a class="product-item" href="<?php the_permalink(); ?>" itemprop="itemListElement" itemscope itemtype="https://schema.org/Offer">
    <div class="miniature">
        <?php 
        $image = get_field('обложка');
        if( !empty($image) ): ?>
            <img 
                srcset="<?php echo $image['sizes']['large']; ?> 800w"
                src="<?php echo $image['sizes']['medium_large']; ?>"
                alt="<?php echo $image['alt']; ?>"
                title="<?php echo $image['title']; ?>"
                loading="lazy"
                itemprop="image"
            >
        <?php endif; ?>
    </div>
    <div class="title-block" itemprop="name"><?php the_title(); ?></div>
    <meta itemprop="price" content="<?php the_field('цена'); ?>">
    <meta itemprop="priceCurrency" content="RUB">
    <link itemprop="availability" href="http://schema.org/InStock">
    <link itemprop="url" href="<?php the_permalink(); ?>">
</a>

контакты

<script type="application/ld+json">
{
    "@context": "http://schema.org",
    "@type": "LocalBusiness",
    "name": "RUSHASH",
    "telephone": "<?php the_field('телефон', 'option'); ?>",
    "email": "<?php the_field('e-mail', 'option'); ?>",
    "address": {
        "@type": "PostalAddress",
        "postalCode": "101000",
        "addressLocality": "г. Москва",
        "streetAddress": "ул. Фридриха Энгельса 46с1"
    },
    "openingHours": "Mo-Su 10:00-19:00"
}
</script>

контакты (если 2 адреса и больше)

<script type="application/ld+json">
{
    "@context": "http://schema.org",
    "@type": "LocalBusiness",
    "name": "RUSHASH",
    "telephone": "<?php the_field('телефон', 'option'); ?>",
    "email": "<?php the_field('e-mail', 'option'); ?>",
    "address": [
        {
        "@type": "PostalAddress",
        "postalCode": "101000",
        "addressLocality": "г. Москва",
        "streetAddress": "БЦ «Магистраль Плаза», 1-й Магистральный тупик, 5А"
        },
        {
        "@type": "PostalAddress",
        "postalCode": "654321",
        "addressLocality": "г. Санкт-Петербург",
        "streetAddress": "ул. Пушкина, д. Колотушкина, 10"
        }
    ],
    "openingHours": "Mo-Su 09:00-21:00"
}
</script>

изображения

<?php
$current_page_id = get_the_ID();
$images = get_attached_media('image', $current_page_id);
?>
<script type="application/ld+json">
{
    "@context": "https://schema.org",
    "@type": "ItemList",
    "itemListElement": [
    <?php
        $count = 1;
        foreach ($images as $image) :
        $image_url = wp_get_attachment_image_url($image->ID, 'full');
        $image_alt = get_post_meta($image->ID, '_wp_attachment_image_alt', true);
    ?>
        {
        "@type": "ImageObject",
        "position": <?php echo $count; ?>,
        "url": "<?php echo esc_url($image_url); ?>",
        "description": "<?php echo esc_attr($image_alt); ?>"
        }<?php if ($count < count($images)) echo ','; ?>
    <?php
        $count++;
        endforeach;
    ?>
    ]
}
</script>

Контакты

Работаем: с ПН по ПТ, с 08:00 до 17:00 (МСК)
Отдыхаем: в СБ и ВС, чтобы быть в тонусе
и реализовывать самые сложные идеи