When they are aware of it, developers often use the <address>
tag to surround contact information for a business or individual on their site. Until very recently, this was technically incorrect: the <address>
element was intended to markup the contact information for the person responsible for the site.
当他们意识到这一点时,开发人员经常使用<address>
标记来包围其站点上的企业或个人的联系信息。 直到最近,这在技术上还是不正确的: <address>
元素旨在标记负责网站的人员的联系信息。
Yesterday Steve Faulkner made me aware that the W3C had changed the HTML 5.2 specification to reflect the common interpretation of the element, much to their credit. However, there are a few things to know about the element in order to use it effectively:
昨天, 史蒂夫·福克纳(Steve Faulkner)使我意识到,W3C 更改了HTML 5.2规范以反映该元素的通用解释,这在很大程度上值得他们的赞扬。 但是,要有效使用元素,需要了解以下几点:
基本地址 (Essential Addresses)
The basic use of the <address>
element is as follows:
<address>
元素的基本用法如下:
<address>
15 Central Park West,<br>
New York, NY 10023,<br>
USA
</address>
The <address>
element is one of the few occasions, aside from poetry, that I would recommend using the <br>
element for formatting; in most other cases, it should be avoided.
除了诗歌之外, <address>
元素是为数不多的几种场合之一,我建议使用<br>
元素进行格式化。 在大多数其他情况下,应避免使用。
While the <address>
element makes the text readable by both humans and the browser, it won’t always be clear to Google what kind of address you’re using: is it the business’s physical address, or does it describe something else? What part of the address is the street information, and which part the state or region?
尽管<address>
元素使文本可以被人类和浏览器读取,但Google并不总是清楚您使用的是哪种地址:这是公司的实际地址,还是描述了其他内容? 地址的哪一部分是街道信息,哪个州或地区?
In some cases, a search engine might be able to guess the correct information from the web page, but I’d also take two extra steps to clarify it:
在某些情况下, 搜索引擎可能能够从网页中猜测正确的信息,但我还要采取两个额外的步骤来澄清它:
If you’re talking about a business with a physical address, register it in Google My Business.
如果您谈论的是具有实际地址的商家,请在Google我的商家中注册。
For businesses and all other locations, use a combination of microdata and a
tel
link to add to the markup:对于企业和所有其他位置 ,请结合使用微数据和
tel
链接添加到标记中:
<div vocab="http://schema.org/" typeof="LocalBusiness">
<img property="image" src="http://www.mokuhawaii.com/shack.jpg"/>
<span property="name">Moku Hawaii Surf Shop and Surf Board Rentals</span>
<address property="address" typeof="PostalAddress">
<span property="streetAddress">2446 Koa Ave,</span>
<span property="addressLocality">Honolulu</span>,
<span property="addressRegion">HI</span>
<span property="postalCode">96815</span>,
<span property="addressCountry">USA</span>
</address>
<a href="tel:+18089266658" property="telephone">+1 808-926-6658</a>
</div>
Adding microformats for even greater compatibility would also be a possibility.
添加微格式以获得更大的兼容性也是可能的。
Note that data entered into Google My Business is canonical, and won’t be affected by markup or changed data on your website. This means that if you take the both options, you must remember to update both if the business location or contact information changes.
请注意,输入到“ Google我的商家”中的数据是规范数据 ,不会受到网站上标记或更改数据的影响。 这意味着如果同时使用这两个选项,则必须记住要在营业地点或联系信息发生更改时同时更新两个选项。
Adding the markup also makes the presentation of the content easier with CSS: no need for <br>
tags!
添加标记还可以使CSS内容显示更加轻松:无需<br>
标签!
结论 (Conclusion)
The new specification definition of the <address>
element aligns it with everyday use, but to make the most out of it, further markup should be added around the address data.
<address>
元素的新规范定义使其与日常使用保持一致,但要充分利用它,应在地址数据周围添加进一步的标记。
翻译自: https://thenewcode.com/1164/Signed-Sealed-Delivered-Using-the-address-Element-in-HTML-52