drouie2014
drouie2014
2013-06-23 00:32
浏览 47
已采纳

PHP抓取内容功能,在meta标签内?

I'm trying to improve my site structure, per Schema.

So I have:

<div class="post">
<?php the_content() ?>
</div>

And I want something like:

<div class="post">
<meta itemprop="articleBody" content="<?php the_content() ?>">
</div>

But that removes images from the content, and appends ">.. So I'm aware I'm not closing it properly. But how do I "make the PHP stop", and be contained within the content="" tags?

Thanks,

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doupian6118
    doupian6118 2013-06-23 01:01
    已采纳

    Ah, I got it!

    Sort of. I just approached it wrong (to be fair, I was mislead by by the recommendation in Google's WMT), for anyone else:

    The tag should be inside the div container, not meta at all (that came from WMT):

    <div itemprop="articleBody" class="post">
         <?php the_content() ?> 
    </div>
    
    点赞 评论

相关推荐