如果我们看一下今天应该包含任何文章的相当大的社交元标签列表,我们可以看到其中一些在右括号之前有“/”,而有些则没有。
<!-- Update your html tag to include the itemscope and itemtype attributes. -->
<html itemscope itemtype="http://schema.org/Article">
<!-- Place this data between the <head> tags of your website -->
<title>Page Title. Maximum length 60-70 characters</title>
<meta name="description" content="Page description. No longer than 155 characters." />
<!-- Schema.org markup for Google+ -->
<meta itemprop="name" content="The Name or Title Here">
<meta itemprop="description" content="This is the page description">
<meta itemprop="image" content="http://www.example.com/image.jpg">
<!-- Twitter Card data -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@publisher_handle">
<meta name="twitter:title" content="Page Title">
<meta name="twitter:description" content="Page description less than 200 characters">
<meta name="twitter:creator" content="@author_handle">
<!-- Twitter summary card with large image must be at least 280x150px -->
<meta name="twitter:image:src" content="http://www.example.com/image.html">
<!-- Open Graph data -->
<meta property="og:title" content="Title Here" />
<meta property="og:type" content="article" />
<meta property="og:url" content="http://www.example.com/" />
<meta property="og:image" content="http://example.com/image.jpg" />
<meta property="og:description" content="Description Here" />
<meta property="og:site_name" content="Site Name, i.e. Moz" />
<meta property="article:published_time" content="2013-09-17T05:59:00+01:00" />
<meta property="article:modified_time" content="2013-09-16T19:08:47+01:00" />
<meta property="article:section" content="Article Section" />
<meta property="article:tag" content="Article Tag" />
<meta property="fb:admins" content="Facebook numberic ID" />
Run Code Online (Sandbox Code Playgroud)
我想知道其背后是否有任何特殊原因,或者只是撰写此列表的文章作者不一致?
这是不一致的。
HTML的规则不要求标签末尾需要有/。
XML 规则规定,如果没有相应的结束标记,则需要使用 /。
XHTML的规则基本上是XML和HTML的结合(因此XHTML中需要斜线)。一些使用 HTML 的人试图遵循大量规则,因此他们最终会遵循 XML 规则,即使不需要遵守 XML 规则。
然而,这些额外的斜线确实不会造成太大伤害。(它们只占用一点点带宽和相关的处理能力。流量可以忽略不计的网站不太可能注意到。)因此,网站管理员可以避免不一致,而且看起来这正是他们正在做的事情。他们可能使用了某些包含斜杠的软件,然后复制并粘贴这些标签,而其他标签是由某些不同的软件创建的。(或者,也许所有这些代码甚至都是由相同的软件创建的,但使用不同的选项,也许在不同的时间。)
| 归档时间: |
|
| 查看次数: |
2212 次 |
| 最近记录: |