简体   繁体   English

引导程序 <address> 标签和itemscope项目类型

[英]Bootstrap <address> tag and itemscope itemtype

My goal is showing a postal address in a web page using bootstrap. 我的目标是使用引导程序在网页中显示邮政地址。 Including Microdata. 包括微数据。

The basic option I was considering is 我正在考虑的基本选项是

<div itemscope itemtype="schema.org/PostalAddress">
   <span itemprop="name">COMPANY NAME</span>
   <span itemprop="streetAddress">xxx</span>
   <!-- more itemprop here -->
</div>

...but regarding that HTML5/Bootstrap provides the <address> tag, I wonder if the following would be correct: ...但是关于HTML5 / Bootstrap提供了<address>标记,我想知道以下是否正确:

<address itemscope itemtype="schema.org/PostalAddress">
   <span itemprop="name">COMPANY NAME</span>
   <span itemprop="streetAddress">xxx</span>
   <!-- more itemprop here -->
</address>

Does using <address> instead of <div> gives any extra feature (for search engines, SEO, others...)? 使用<address>而不是<div>具有任何其他功能(用于搜索引擎,SEO等)?

What's the best way of doing so? 最好的方法是什么?

Edited: In this case the address refers the contact information for the author/owner of the page. 编辑:在这种情况下,地址指的是页面作者/所有者的联系信息。

HTML markup and Microdata markup are two separate worlds. HTML标记和Microdata标记是两个独立的世界。

Microdata parsers don't care if div or address is used, they have to handle them the same. 微数据解析器不在乎是否使用divaddress ,它们必须对其进行相同的处理。 You only have to make sure to use an element that produces the value type you need (ie, it's easy for item , but there are differences for string vs. datetime vs. absolute URL ). 您只需要确保使用产生所需值类型的元素即可 (即, item很容易,但stringdatetime绝对URL有所不同)。

HTML parsers care about the HTML elements you use, but not about your Microdata markup. HTML解析器关心您使用的HTML元素,而不关心您的微数据标记。 Using address instead of div conveys that the content of that element represents contact information (for the nearest article or body ). 使用address代替div表示该元素的内容表示联系信息(针对最近的articlebody )。 What to make of this information is up to the consumer (search engines, accessibility tools, browser add-ons, etc.). 该信息由用户(搜索引擎,可访问性工具,浏览器附加组件等)决定。

(And of course there might be consumers that take both, the HTML and the Microdata, into account, and deduce some clever things.) (当然,可能有一些消费者同时考虑了HTML和微数据,并推断出一些巧妙的方法。)

The best way? 最好的方法? First get your HTML right (use the most specific elements that are appropriate for your purpose) and then add Microdata attributes to your markup (and, if needed for that, add div / span elements). 首先正确设置HTML(使用最适合您目的的特定元素),然后将Microdata属性添加到标记中(并为此添加div / span元素)。

See my answer Markup for postal addresses for the process (it uses RDFa instead of Microdata, but the idea is the same). 请参阅我的答案“ 标记”以获取该过程的邮政地址 (它使用RDFa而不是“微数据”,但是想法是相同的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM