サーチコンソールで構造化データエラーでたときの対処。
headタグ内に以下を記述する。
<?php if(is_single()||is_page()) { ?>
<?php while (have_posts()) : the_post(); ?>
<script type="application/ld+json"> {
"@context": "http://schema.org",
"@type": "BlogPosting",
"mainEntityOfPage":{ "@type":"WebPage", "@id":"<?php the_permalink(); ?>" },
"headline": "<?php the_title();?>",
"image": {
"@type": "ImageObject",
"url": "ロゴのURL.jpg",
"height": 696,
"width": 696 },
"datePublished": "<?php the_time('Y/m/d') ?>",
"dateModified": "<?php the_modified_date('Y/m/d') ?>",
"author": {
"@type": "Person",
"name": "<?php the_author_meta('nickname'); ?>" },
"publisher": { "@type": "Organization",
"name": "<?php bloginfo('name'); ?>",
"logo": {
"@type": "ImageObject", "url": "ロゴのURL.jpg",
"width": 250,
"height": 60 }
},
"description": "<?php echo mb_substr(strip_tags($post-> post_content), 0, 60); ?>…" }
</script>
<?php endwhile; ?>
<?php } else { ?>
<?php } ?>