LoginSignup
1

More than 5 years have passed since last update.

サーチコンソールで構造化データエラーでたときの対処

Last updated at Posted at 2017-05-29

サーチコンソールで構造化データエラーでたときの対処。
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 } ?>

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1