问题原文
原帖链接 · cag8f · CC BY-SA 3.0
I'd like to add Schema.org data, and am trying to follow instructions given to me about how to do so. The instructions indicate that I should change my <header> tag from:
<header>
to
<header itemscope="itemscope" itemtype="http://schema.org/WPHeader">
But is this helpful by itself? It appears to merely add blank data. Am I misunderstanding something? Where do I actually assign values to some of the WPHeader properties that pertain to my specific site? Or does merely adding this blank schema template somehow do something for my site? I don't think the instructions have made that clear, but I may have missed something.
已采纳解答
原帖链接 · unor · CC BY-SA 3.0
Schema.org
I have the impression that many WordPress theme creators add these types. My guess why: These are one of the few types that can be added without knowing the site’s content. The header is the header, no matter what the site about, etc.
But I recommend to omit WebPageElement and its sub-types (currently: SiteNavigationElement, Table, WPAdBlock, WPFooter, WPHeader, WPSideBar).
They are typically useless for webpages, and they can even stand in the way of providing accurate data in RDFa/Microdata.
A few of my related posts, giving more details:
- Schema.org issue: The purpose of WebPageElement and mainContentOfPage
- Stack Overflow: Why use Schema.org microdata to mark up web page elements?
- WordPress Development SE: Wordpress Schema.org Markup. What value does it add?
Microdata
If you only have something like
<header itemscope="itemscope" itemtype="http://schema.org/WPHeader">
</header>
then yes, it doesn’t convey any data, other than "There exists a WPHeader."
If you want to add properties, you have to nest elements and add corresponding itemprop attributes. For example, to specify the name of the WPHeader, it could look like:
<header itemscope="itemscope" itemtype="http://schema.org/WPHeader">
<span itemprop="name">Name of the webpage’s header</span>
</header>
Note that this is not for the name of the webpage! This would go under WebPage. It’s really the name of the header (and in almost all cases, you don’t have a name for a webpage header). Which is one of the reasons why types like these aren’t really useful for normal websites.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
