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

Correct way to use sameAs itemprop in Microdata

· 52CE 我爱测

My client has recently implemented the sameAs markup for the social media profiles. They have used Microdata as they don't want to use JSON-LD as they feel it'll be some work to go through the site and change it all around. I hav…

问题原文

原帖链接 · GrapeSoda · CC BY-SA 3.0

My client has recently implemented the sameAs markup for the social media profiles. They have used Microdata as they don't want to use JSON-LD as they feel it'll be some work to go through the site and change it all around.

I have noticed that they have added a div with an itemtype of Organization and a link tag with itemprop not wrapping anything.

Example:

<div itemtype="http://schema.org/Organization">
    <link itemprop="url" href="domain name">
    <a itemprop="sameAs" href="instagram"></a>
    <a itemprop="sameAs" href="facebook/"></a>
    <a itemprop="sameAs" href="twitter"></a>
    <a itemprop="sameAs" href="google+"></a>
</div>

This has resulted in only 2 of the social media profiles appearing in the knowledge graph.

They have icons further down the page with links to the social media profiles. Should they not instead wrap these anchors around those instead?

已采纳解答

原帖链接 · unor · CC BY-SA 3.0

If they have visible links to these social media profiles, it’s the best practice to mark up these links, instead of repeating the links and marking up the "invisible" variant:

<div itemscope itemtype="http://schema.org/Organization">

  <!-- … -->

  <ul>
   <li><a itemprop="sameAs" href="http://social-network-1.example.net/foo">Social Network 1</a></li>
   <li><a itemprop="sameAs" href="http://social-network-2.example.net/foo">Social Network 2</a></li>
  </ul>

</div>

If they don’t have visible links, or if it’s not possible to add Microdata markup to existing links (e.g., because the CMS doesn’t allow it), repeating them is better than not providing Microdata for them at all.

If repeating them and needing them to be invisible, the link element should be used instead of empty a elements:

<div itemscope itemtype="http://schema.org/Organization">
  <meta itemprop="name" href="Foo" />
  <link itemprop="url" href="http://example.com/" />
  <link itemprop="sameAs" href="http://social-network-1.example.net/foo" />
  <link itemprop="sameAs" href="http://social-network-2.example.net/foo" />
</div>

Even if the page doesn’t contain any visible social media links, adding them in Microdata is still better than not adding them; but in such a case Google might decide not to use them for their Social Profile Links.

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

资料来源与适用范围

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

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

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