大网数据广告活动
网站运营与故障问答

Adding Schema.org’s "WPHeader" with Microdata

· 52CE 我爱测

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:/…

问题原文

原帖链接 · 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:

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2017-06-28)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。