什么是用于标记博客摘要的最佳HTML5标签? [英] What's the best HTML5 tag to use for marking up blog excerpts?
问题描述
这是博客常见的模式,包含列出相关博客文章的存档页面(例如按日期或类别),以及摘录(段落或)和链接。然而,我无法弄清楚哪些HTML5元素最适合用于单个帖子。
< article>
标签可能看起来很合适(当然,如果您显示的是整个内容),但我不确定它是否适合摘录。 规范 :
文章元素表示文档,页面,应用程序或网站中的独立组合,并且原则上独立于可分配或可重用的,例如
是否真的是一个独立且可独立分发的内容片段?我不太确定。
其他选项可能是< blockquote>
标记(但它会引用你自己的帖子很奇怪,或者只是一个包含标题和段落的< ol>
列表(按发布日期排序)。
有什么想法?
我会用:
< li>
< blockquote cite =原始网址>
< / blockquote>
< / li>
< blockquote>
是最合适的:
blockquote元素表示从另一个来源引用的部分。
引用自己并不奇怪。元素的定义并不是说你必须引用其他人。
我认为< article>
(而不是< li>
)是可以接受的,但这不是必须的(文章的定义非常松散,它应该被称为< infolump>
;)
我对< article>
的试金石是否在RSS / Atom Feed中有用,你可以找到它仅提供文章摘录。
< summary>
元素只是< details>
中的一部分,它有不同的用途。
< aside>
描述页面内容的角色。当摘录是归档页面的主要部分时,它不是真正的切线内容。 OTOH如果它是一个帖子页上的另请参阅部分,那么< aside>
将是完美的。
It's a common pattern for blogs to have archive pages (eg by date or category) which list relevant blog posts, along with excerpts (a paragraph or) and a link. I can't quite work out which of the HTML5 elements it's best to use for the individual posts, however.
The <article>
tag might seem like a good fit (and certainly would be if you were displaying the whole content), but I'm not sure whether it's appropriate for excerpts. The specification says:
The article element represents a self-contained composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication.
Is an excerpt really a self-contained and independently distributable piece of content? I'm not so sure.
Other options might be the <blockquote>
tag (but it'd be weird to be quoting your own posts), or simply a <ol>
list (ordered by publication date) containing headers and paragraphs.
Any thoughts?
I'd use:
<li>
<blockquote cite="original URL">
</blockquote>
</li>
<blockquote>
is most appropriate for this:
The blockquote element represents a section that is quoted from another source.
Quoting yourself is not weird. The definition of the element doesn't say you have to quote somebody else. You do quote a document that lives under another URL.
I think <article>
(instead of <li>
) would be acceptable, but it's not necessary (the definition of article is pretty lax, it should have been called <infolump>
;)
My litmus test for <article>
is whether it'd be useful in an RSS/Atom feed, and you can find feeds with just article excerpts.
The <summary>
element is only a part of <details>
, which has different purpose.
<aside>
describes role of the content within a page. When the excerpts are the main part of archive page, it's not really a tangential content. OTOH if it were a "See also" section on a post page, then <aside>
would be perfect.
这篇关于什么是用于标记博客摘要的最佳HTML5标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!