hatom: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
(s/<source>/<syntaxhighlight>/)
 
(368 intermediate revisions by 66 users not shown)
Line 1: Line 1:
= hAtom =
{{DISPLAYTITLE:hAtom 0.1}}
{{latest|h-entry}}
{{Template:DraftSpecification}}


hAtom is a microformat for content that can be syndicated, primarily but not exclusively weblog postings. hAtom is a strongly based on a subset of the [http://www.atomenabled.org/ Atom] syndication format; every concept in hAtom has a corresponding definition in Atom.  
hAtom is a microformat for content that can be syndicated, primarily but not exclusively weblog postings. hAtom is based on a subset of the [http://www.atomenabled.org/ Atom] syndication format. hAtom will be one of several [[microformats]] open standards.
__TOC__
== Draft Specification ==


NOTE: the structure is in the process of being constructed, please give me a few days to get it in shape! [[DavidJanes]]
<div class="vcard">
;<span class="role">Editor/Author</span>
:<span class="fn">[http://blogmatrix.blogmatrix.com/ David Janes]</span> <span class="org">([http://www.blogmatrix.com BlogMatrix, Inc.])</span>
</div>


__TOC__
;Contributors
:<span class="vcard"><span class="fn">[http://members.optusnet.com.au/benjamincarlyle/benjamin/blog/ Benjamin Carlyle]</span></span>
:<span class="vcard"><span class="fn">[[User:Tantek|Tantek Çelik]]</span> (<span class="url">http://tantek.com/</span> and before at [http://technorati.com Technorati, Inc.])</span>


== Draft Specification ==
[[hatom#Copyright|copyright]] and [[hatom#Patents|patents]] statements apply.


=== Editor ===
== Status ==
* [http://blogmatrix.blogmatrix.com/ David Janes], [http://www.blogmatrix.com BlogMatrix, Inc.]
hAtom 0.1 is a microformats.org draft specification. Public discussion on hAtom takes place on [[hatom-feedback]], the #microformats [[irc]] channel on irc.freenode.net, and [http://microformats.org/discuss/mail/microformats-discuss/ microformats-discuss mailing list].


=== Authors ===
=== Available languages ===
* [http://blogmatrix.blogmatrix.com/ David Janes], [http://www.blogmatrix.com BlogMatrix, Inc]
The English version of this specification is the only normative version. For translations of this document see the [[#translations]] section.


=== Copyright ===
=== Errata and Updates ===
{{MicroFormatCopyrightStatement2005}}
Known errors and issues in this specification are corrected in [[hatom-issues-resolved|resolved]] and [[hatom-issues-closed|closed]] issues. Please check there before reporting [[hatom-issues|issues]].


=== Patents ===
The hAtom 0.2 update is currently under development and incorporates known errata corrections as well as the [[value-class-pattern]].
{{MicroFormatPatentStatement}}


== Introduction ==
== Introduction ==
hAtom is a [[microformat]] for identifying semantic information in weblog posts and practically any other place [http://www.atomenabled.org/ Atom] may be used, such as news articles. hAtom content is easily added to most blogs by simple modifications to the blog's template definitions.


== Semantic XHTML Design Principles ==
{{rfc-2119-intro}}
{{semantic-xhtml-design-principles}}
 
== Example ==
Here is a simple blog post example:
 
<syntaxhighlight lang="html">
<article class="hentry">
  <h1 class="entry-title">Microformats are amazing</h1>
  <p>Published by <span class="author vcard"><span class="fn">W. Developer</span></span>
    on <time class="published" datetime="2013-06-13 12:00:00">13<sup>th</sup> June 2013</time></p>
 
  <p class="entry-summary">In which I extoll the virtues of using microformats.</p>
 
  <div class="entry-content">
    <p>Blah blah blah</p>
  </div>
</article>
</syntaxhighlight>
 
=== Get started ===
The class '''<code>hentry</code>''' is a ''root class name'' that indicates the presence of an hAtom entry.
 
'''<code>entry-title</code>''', '''<code>author</code>''', '''<code>published</code>''', '''<code>entry-summary</code>''', '''<code>entry-content</code>''' and the other hAtom property classnames listed below define properties of the entry.


== Format ==
== Format ==
=== In General ===
=== In General ===
The [http://atomenabled.org/developers/syndication/#person Atom Syndication Format] provides the conceptual basis for this microformat, with the following caveats:
* Atom provides a lot more functionality than we need for a "blog post" microformat, so we've taken the minimal number of elements needed.
* the "logical" model of hAtom is that of Atom. If there is a conflict, Atom should be taken as correct.
* the "physical" model of hAtom -- the actual writing of elements -- is a lot more varied than Atom provides for, due to the variety of ways weblogs are actually produced in the wild. The hAtom microformat provides a number of rules for "bridging the gap"


=== Schema ===
=== Schema ===
Schema elements are based on the Atom nomenclature and follow the microformat pattern of prefixing a unique identifier (in this case, <code>atom</code>) on the outermost container elements -- the Feed or Entry. The parts of this microformat are based on analysis of many weblog, bulletin board and media posts and can be read [[blog-post-brainstorming#Discovered_Elements]]. Note the renaming of 'EntryGroup' to 'Feed' to be more consistent with Atom ternminology.
Schema elements are based on the Atom nomenclature and follow the microformat pattern of prefixing a unique identifier (in this case, '<code>h</code>') on the outermost container elements -- the Feed or Entry. The parts of this microformat are based on analysis of many weblog, bulletin board and media posts and can be read [[blog-post-brainstorming#Discovered_Elements]].


==== Nomenclature ====
The hAtom schema consists of the following:


{| width="100%" border="1" cellspacing="0"
* hfeed ('''<code>hfeed</code>'''). optional.
|-
** '''<code>feed category</code>'''. optional. keywords or phrases, using '''[[rel-tag]]'''.
! width="150" | Concept
** [[hentry]] ('''<code>hentry</code>''').  
! Atom Identifier
*** '''<code>entry-title</code>'''. required. text.
! hAtom Microformat Usage
*** '''<code>entry-content</code>'''. optional (see field description). text. [*]
|-
*** '''<code>entry-summary</code>'''. optional. text.
| Feed
*** '''<code>updated</code>'''. required using [[value-class-pattern#Date_and_time_parsing|value class pattern date and time]]. [*]
| <code>atom:feed</code>
*** '''<code>published</code>'''. optional using [[value-class-pattern#Date_and_time_parsing|value class pattern date and time]].
| add <code>class="atomfeed"</code>; OR implicit in the XHTML page
*** '''<code>author</code>'''. required using '''[[hcard|hCard]]'''. [*]
|-
*** '''<code>bookmark</code>''' (permalink). optional, using '''[[rel-bookmark]]'''.
| Feed Title
*** tags. optional. keywords or phrases, using '''[[rel-tag]]'''.
| <code>atom:title</code>
| ''Not defined in the first iteration of this proposal.''
|-
| Feed Permalink
| <code>atom:link@rel=alternate</code>
| ''Not defined in the first iteration of this proposal.''
|-
| Entry
| <code>atom:entry</code>
| Add <code>class="atomentry"</code>; if practical, also define <code>id="unique-identifier"</code> to the Entry.
|-
| Entry Title
| <code>atom:title</code>
| Use <code>&lt;h#></code> in block elements; OR non-preferentially add <code>class="title"</code> in inline elements.
|-
| Entry Content
| <code>atom:content</code>
| Add <code>class="content"</code> to all appropriate blocks. Multiple Entry Content blocks are logically considered one concatenated <code>atom:content</code> equivalent.
|-
| Entry Summary
| <code>atom:summary</code>
| Add <code>class="summary"</code> to all appropriate blocks. Multiple Entry Summary blocks are logically considered one concatenated <code>atom:summary</code> equivalent.
|-
| Entry Permalink
| <code>atom:link</code>
| Add <code>rel="link"</code>.
|-
| Entry Created
| <code>atom:published</code>
| Use <code>&lt;abbr class="published" title="YYYYMMYYThh:mm:ss"></code>...<code>&lt;/abbr></code>, following the [[datetime-design-pattern]].
|-
| Entry Author
| <code>atom:author</code>
| Use <code>&lt;address class="vcard"></code>...<code>&lt;/address></code>
|}


==== Nesting Rules ====
[*] Some required elements have defaults if missing, see below.


{| width="100%" border="1" cellspacing="0"
=== Field and Element Details ===
|-
! width="150" | Concept
! Nests In
! Cardinality
! Notes
|-
| Feed
|-
| Feed Title
|-
| Feed Permalink
|-
| Entry
|-
| Entry Title
|-
| Entry Content
|-
| Entry Summary
|-
| Entry Permalink
|-
| Entry Created
|-
| Entry Author
|}


==== Disambiguation ====
==== Rules and Definitions ====
===== Feed =====
===== Feed =====
* an XHTML Feed element is identified by <code>class="atomfeed"</code>
* a Feed element is identified by the class name <code>hfeed</code>
* a Feed element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.1.1 atom feed]
* a Feed element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.1.1 Atom feed]
: ''In particular, as a container for Entrys.''
* the Feed element is optional and, if missing, is assumed to be the page
* hAtom documents SHOULD enclose Entrys in a Feed element
* hAtom documents {{may}} have multiple Feed elements
: ''If there is no enclosing Feed element, context is assumed from the document itself and its header.''
* hAtom documents MAY have multiple, non-nested Feed elements
: ''This may happen on news pages, or weblogs with "mini-blogs" on the sidebar.''


===== Feed Title =====
===== Feed Category =====
''Not defined in the first iteration of this proposal.''
* a Feed Category element is identified by [[rel-tag]]
* a Feed {{may}} have a Feed Category
* a Feed Category element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.2 Atom category] inside a [http://www.atomenabled.org/developers/syndication/#optionalFeedElements feed]
* Feed Category elements {{must}} appear inside a Feed element but not inside an Entry element
* the [[rel-tag]] <code>href</code> encodes the atom <code>category:term</code>; the link text defines the atom <code>category:label</code>


===== Feed Permalink =====
===== Entry =====
''Not defined in the first iteration of this proposal.''
* an Entry element is identified by class name <code>hentry</code>
* an Entry element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.1.2 Atom entry]
* any microformat content inside a <code>&lt;blockquote></code> or <code>&lt;q></code> element within the Entry should not be considered part of the Entry.
: ''This allows quoting other microformated data without worry of corrupting the model''


===== Entry =====
===== Entry Category =====
* an Entry element is identified by <code>class="atomenty"</code>
* an Entry Category element is identified by [[rel-tag]]
* an Entry element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.1.2 atom entry]
* an Entry {{may}} have an Entry Category
* a weblog entry MUST be enclosed in a single Entry element
* an Entry Category element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.2 Atom category] inside an [http://www.atomenabled.org/developers/syndication/#optionalEntryElements entry]
: ''That's what it's for, after all.''
* the [[rel-tag]] <code>href</code> encodes the atom <code>category:term</code>; the link text defines the atom <code>category:label</code>
* Entrys MUST NOT be nested
: ''See [[#Disabmiguation]] and [[#Entry_Content]] for more details.''
* Entrys MUST NOT belong to more than one Feed element
: ''That is, an Entry belongs to 0 or 1 Feeds.''


===== Entry Title =====
===== Entry Title =====
* an XHTML Entry Title element is identified by XXX OR non-preferentially <code>class="title"</code>
* an Entry Title element is identified by the class name <code>entry-title</code>
* a Entry Title element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.14 atom entry title]
* an Entry {{should}} have an Entry Title
* an Entry Title element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.14 Atom entry title]
* if the Entry Title is missing, use
** the first <code>&lt;h#></code> element in the Entry, or
** the <code>&lt;title></code> of the page, if there is no enclosing Feed element, or
** assume it is the empty string


===== Entry Content =====
===== Entry Content =====
* an XHTML Entry Content element is identified by <code>class="content"</code>
* an Entry Content element is identified by class name <code>entry-content</code>
* a Entry Content element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#atomContent atom content]
* an Entry {{should}} have Entry Content
* an Entry Content element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#atomContent Atom content]
* an Entry {{may}} have 0 or more Entry Content elements. The "logical Entry Content" of an Entry is the concatenation, in order of appearance, of all the Entry Contents within the Entry
: ''Many web logs split content into multiple sections with a "Read More" link and JavaScript tricks. This is also needed in cases where Entry Titles are coded in-line and are considered part of the content.''
* if the Entry Content is missing, assume it is the empty string


===== Entry Summary =====
===== Entry Summary =====
* an XHTML Entry Summary element is identified by <code>class="summary"</code>
* an Entry Summary element is identified by class name <code>entry-summary</code>
* a Entry Summary element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.13 atom summary]
* an Entry Summary element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.13 Atom summary]
* an Entry {{may}} have 0 or more Entry Summary elements. The "logical Entry Summary" of an Entry is the concatenation, in order of appearance, of all the Entry Summarys within the Entry


===== Entry Permalink =====
===== Entry Permalink =====
* an XHTML Entry Permalink element is identified by <code>rel="bookmark"</code>
* an Entry Permalink element is identified by [[rel-bookmark]]
: ''We recognize that we have broken from Atom terminology at this point. See [[hatom-issues]] for discussion.''
* an Entry {{should}} have an Entry Permalink
* a Entry Permalink element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.7 atom link in an entry]
* an Entry Permalink element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.7 Atom link in an entry]
* if the Entry Permalink is missing, use the URI of the page; if the Entry has an "id" attribute, add that as a fragment to the page URI to distinguish individual entries
 
===== Entry Updated =====
* an Entry Updated element is identified by class name <code>updated</code>
* an Entry Updated element represents the concept of [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.15 Atom updated]
* an Entry {{should}} have an Entry Updated element
* use the [[value-class-pattern#Date_and_time_parsing|value class pattern date and time]] to encode the updated datetime
* if there is no Entry Updated element,
** use the Entry Published element, if present
** otherwise the page is invalid hAtom


===== Entry Published =====
===== Entry Published =====
* an XHTML Entry Published element is identified by <code>class="posted"</code>
* an Entry Published element is identified by the class name <code>published</code>
* a Entry Published element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.9 atom published]
* an Entry Published element represents the concept of [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.9 Atom published]
* use the [[value-class-pattern#Date_and_time_parsing|value class pattern date and time]] to encode the published datetime


===== Entry Author =====
===== Entry Author =====
* an XHTML Entry Author element is identified by <code>class="xxx"</code>
* an Entry Author element is represented by class name <code>author</code>
* a Entry Author element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.1 atom author]
* an Entry Author element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.1 Atom author]
* an Entry Author element {{must}} be encoded in an [[hcard|hCard]]
* an Entry Author element {{should}} be encoded in an <code>&lt;address></code> element
* an Entry {{should}} have at least one Entry Author element
* an Entry {{may}} have more than one Entry Author elements
* if the Entry Author is missing
** find the [[algorithm-nearest-in-parent|Nearest In Parent]] <code>&lt;address></code> element(s) with class name <code>author</code> and that is/are a valid [[hcard|hCard]]
** otherwise the entry is invalid hAtom


=== XMDP Profile ===
=== XMDP Profile ===
 
See [[hatom-profile]].
=== Parsing Details ===


== Examples ==
== Examples ==


This section is informative.
See [[hatom-examples]].


=== Transformation 1 ===
=== Examples in the wild ===


A well behaved weblog.
See [[hatom-examples-in-wild]].


Original:
== Implementations ==


<pre><nowiki>
See [[hatom-implementations]].
<body>
<div id="wrap">
  <div id="content">
  ...
  <div class="entry">
    <h3 id="post-60">
    <a href="http://www.microformats.org/blog/..." rel="bookmark" title="...">Wiki Attack</a>
    </h3>
    <p>We had a bit of trouble with ...</p>
    <p>We&#8217;ve restored the wiki and ...</p>
    <p>If anyone is working to combat said spammers ...</p>


    <h4 class="tags">Technorati Tags:</h4>
== Copyright ==
    <ul class="tags">
{{MicroFormatCopyrightStatement2005}}
    <li><a href="http://technorati.com/tag/mediawiki" rel="tag">mediawiki</a></li>
* [[User:Tantek|Tantek]]: I release all my contributions to this specification into the public domain and I encourage the other authors to do so as well.
    <li><a href="http://technorati.com/tag/microformats" rel="tag">microformats</a></li>
** When all authors/editors have done so, we can remove the MicroFormatCopyrightStatement template reference and replace it with the MicroFormatPublicDomainContributionStatement.
    <li><a href="http://technorati.com/tag/spam" rel="tag">spam</a></li>
    </ul>


    <ul class="post-info">
== Patents ==
    <li>
{{MicroFormatPatentStatement}}
      <a href="http://www.microformats.org/blog/..." rel="bookmark" title="...">October 10th, 2005</a>
    </li>
    <li>
      <address class="vcard"><a class="url fn" href="http://theryanking.com">Ryan King</a></address>
    </li>
    <li>
      <a href="http://www.microformats.org/blog/...">4 Comments</a>
    </li>
    </ul>
  </div>
 
  <div class="entry">
  ....
  </div>
  ...
  </div>
</div>
</body>
</nowiki></pre>
 
Transformed to hAtom compliant (shown in UPPER CASE for visibility only):
 
<pre><nowiki>
<body>
<div id="wrap">
  <div id="ATOMFEED content">
  ...
  <div class="ATOMENTRY entry" ID="post-60">
    <h3>
    <a href="http://www.microformats.org/blog/..." rel="LINK bookmark" title="...">Wiki Attack</a>
    </h3>
    <DIV CLASS="CONTENT">
    <p>We had a bit of trouble with ...</p>
    <p>We&#8217;ve restored the wiki and ...</p>
    <p>If anyone is working to combat said spammers ...</p>
    </DIV>
 
    <h4 class="tags">Technorati Tags:</h4>
    <ul class="tags">
    <li><a href="http://technorati.com/tag/mediawiki" rel="tag">mediawiki</a></li>
    <li><a href="http://technorati.com/tag/microformats" rel="tag">microformats</a></li>
    <li><a href="http://technorati.com/tag/spam" rel="tag">spam</a></li>
    </ul>
 
    <ul class="post-info">
    <li>
      <a href="http://www.microformats.org/blog/..." rel="LINK bookmark"
        title="..."><ABBR CLASS="POSTED" TITLE="20051010T14:07:00-0700">October 10th, 2005</ABBR></a>
    </li>
    <li>
      <address class="vcard"><a class="url fn" href="http://theryanking.com">Ryan King</a></address>
    </li>
    <li>
      <a href="http://www.microformats.org/blog/...">4 Comments</a>
    </li>
    </ul>
  </div>
 
  <div class="entry entry" ID="post-59">
  ....
  </div>
  ...
  </div>
</div>
</body>
</nowiki></pre>
 
Changes:
* Added <code>class="feed"</code> to Feed
* Added <code>class="entry"</code> to each Entry
* Moved <code>id="###"</code> from <code>&lt;h3></code> to Entry
* Added <code>rel="link"</code> to all Entry Permalinks
* Added <code>&lt;div class="content"></code>...<code>&lt;/div></code> around the Entry Content
* Added <code>&lt;abbr class="posted" title="YYYYMMDDThh:mm:ss+ZZZZ"></code>...<code>&lt;/abbr></code> around the Entry Datetime
 
Also note:
* We did not need to add a <code>&lt;address></code> element
* We did not need to add a <code>&lt;h#></code> element
 
=== Transformation 2 ===
 
A not-so well behaved weblog (an older blogspot weblog)
 
Original:
 
<pre><nowiki>
<body bgcolor="...">
 
<div class="posts">
  <a name="112993192128302715">&nbsp;</a><br>
  <div style="clear:both;"></div><strong>Nelson's final prayer</strong>
  written on the night before Trafalgar:<blockquote>May the Great God, ... heart.
  <div style="clear:both; padding-bottom: 0.25em;"></div>
  <br>
  <span class="byline">
  posted by Natalie at
  <a href="2005_10_16_nataliesolent_archive.html#112993192128302715">9:49 PM</a>
  </span>
</div>
 
<div class="posts">
  <a name="112993022840118939">&nbsp;</a>
  <br>
  <div style="clear:both;"></div><strong>I really, truly </strong>didn't go ... view.
  <div style="clear:both; padding-bottom: 0.25em;"></div>
  <br>
  <span class="byline">
  posted by Natalie at
  <a href="2005_10_16_nataliesolent_archive.html#112993022840118939">9:28 PM</a>
  </span>
</div>
...
 
</body>
</nowiki></pre>
 
Transformed to hAtom compliant (shown in UPPER CASE for visibility only):
 
<pre><nowiki>
<body bgcolor="...">
 
<DIV CLASS="ATOMFEED">
  <div class="ATOMENTRY posts" ID="112993192128302715">
  <strong CLASS="TITLE CONTENT">
    Nelson's final prayer
  </strong>
  <SPAN CLASS="CONTENT">
    written on the night before Trafalgar:<blockquote>May the Great God, ... heart.
  </SPAN>
  <DIV>
    <span class="byline">posted by <address>Natalie</address> at
    <a REL="LINK" href="HTTP://NATALIESOLENT.BLOGSPOT.COM/2005_10_16_nataliesolent_archive.html#112993192128302715">
    <ABBR CLASS="POSTED" TITLE="20051024T094900-0000">9:49 PM</ABBR></a>
    </span>
  </DIV>
  </div>
 
  <div class="entry posts" ID="112993022840118939">
  <strong CLASS="TITLE CONTENT">I really, truly </strong>
  <SPAN CLASS="CONTENT">
    didn't go ... view.
  </SPAN>
  <DIV>
    <span class="byline">
    posted by <address>Natalie</address> at
    <a REL="LINK" href="HTTP://NATALIESOLENT.BLOGSPOT.COM/2005_10_16_nataliesolent_archive.html#112993022840118939">
    <ABBR CLASS="POSTED" TITLE="20051024T094900-0000">9:28 PM</ABBR></a>
    </span>
  </DIV>
  </div>
...
</DIV>
 
</body>
</nowiki></pre>
 
Changes:
* Added <code>class="feed"</code> to Feed
* Added <code>class="entry"</code> to each Entry
* Moved <code>id="###"</code> up to the Entry (and deleted the empty anchor block)
* Added <code>rel="link"</code> to the Entry Permalinks
* Made the Entry Permalink non-relative
* Added <code>&lt;span class="title"></code>...<code>&lt;/div></code> around the Entry Title
* Added <code>&lt;span class="content"></code>...<code>&lt;/div></code> around the Entry Title (!)
* Added <code>&lt;span class="content"></code>...<code>&lt;/div></code> around the Entry Content
* Added <code>&lt;abbr class="posted" title="YYYYMMDDThh:mm:ss+ZZZZ"></code>...<code>&lt;/abbr></code> around the Entry Datetime
* Added <code>&lt;address></code> to the poster's name
 
Also note:
* there are multiple content blocks, because Natalie Solent embeds the title in the content
* cleaned up lots of crap HTML presentation stuff, with the assumption it would be fixed in the stylesheet
* this is one of the uglier transformations you're likely to see
 
=== Transformation 3 ===
 
A media page.
 
Original:
 
<pre><nowiki>
</nowiki></pre>
 
Transformed to hAtom compliant:
 
<pre><nowiki>
</nowiki></pre>
 
Changes:
*
 
=== Transformation 4 ===
 
A bulletin board ([http://forums.punbb.org/viewtopic.php?id=9135 PunBB])
 
Original:
 
<pre><nowiki>
<body>
<div id="punwrap">
  <div id="punviewtopic" class="pun">
 
  <div id="brdheader" class="block">
    ... header stuff ...
  </div>
 
  <div id="announce" class="block">
    ... announcement stuff ...
  </div>
 
  <div class="linkst">
    ... controls for the blog
  </div>
 
  <div id="p54390" class="blockpost rowodd firstpost">
    <h2>
    <span><span class="conr">#1&nbsp;</span>
    <a href="viewtopic.php?pid=54390#p54390">2005-10-16 10:36:24</a></span>
    </h2>
    <div class="box">
    <div class="inbox">
      <div class="postleft">
      <dl>
        <dt><strong><a href="profile.php?id=2">Rickard</a></strong></dt>
 
        <dd class="usertitle"><strong>PunBB Developer</strong></dd>
        <dd class="postavatar"><img src="img/avatars/2.png" width="60" height="60" alt="" /></dd>
        <dd>From: 127.0.0.1</dd>
        <dd>Registered: 2001-11-02</dd>
        <dd>Posts: 7806</dd>
        <dd class="usercontacts"><a href="http://www.punbb.org/">Website</a></dd>
 
      </dl>
      </div>
      <div class="postright">
      <h3>PunBB 1.2.9</h3>
      <div class="postmsg">
        <p>Just a quick note this time....</p>
 
      </div>
      <div class="postsignature"><hr />&quot;Programming is like sex: ...</div>
      </div>
      <div class="clearer"></div>
      <div class="postfootleft"><p>Offline</p></div>
      <div class="postfootright"><div>&nbsp;</div></div>
    </div>
    </div>
 
  </div>
 
  <div id="p54392" class="blockpost roweven">
    <h2><span><span class="conr">#2&nbsp;</span><a href="viewtopic.php?pid=54392#p54392">2005-10-16 10:54:41</a></span></h2>
    <div class="box">
    <div class="inbox">
      <div class="postleft">
      <dl>
        <dt><strong><a href="profile.php?id=5298">IdleFire</a></strong></dt>
 
        <dd class="usertitle"><strong>Member</strong></dd>
        <dd class="postavatar"></dd>
        <dd>Registered: 2005-10-14</dd>
        <dd>Posts: 27</dd>
      </dl>
      </div>
      <div class="postright">
 
      <h3> Re: PunBB 1.2.9</h3>
      <div class="postmsg">
        <p>...</p>
      </div>
      </div>
      <div class="clearer"></div>
      <div class="postfootleft"><p>Offline</p></div>
 
      <div class="postfootright"><div>&nbsp;</div></div>
    </div>
    </div>
  </div>
 
  ... more entries ...
 
  <div id="brdfooter" class="block">
    ... footer stuff ...
  </div>
 
  </div>
</div>
</body>
</nowiki></pre>
 
Transformed to hAtom compliant (changes shown in UPPER CASE for visibility only):
 
<pre><nowiki>
<body>
<div id="punwrap">
  <div id="punviewtopic" class="pun">
 
  <div id="brdheader" class="block">
    ... header stuff ...
  </div>
 
  <div id="announce" class="block">
    ... announcement stuff ...
  </div>
 
  <div class="linkst">
    ... controls for the blog
  </div>
 
  <div id="p54390" class="ATOMENTRY blockpost rowodd firstpost">
    <h2>
    <span><span class="conr">#1&nbsp;</span>
    <a REL="BOOKMARK" href="HTTP://FORUMS.PUNBB.ORG/viewtopic.php?pid=54390#p54390">
      <ABBR CLASS="POSTED" TITLE="20051016T103624-0500">2005-10-16 10:36:24</ABBR>
    </a></span>
    </h2>
    <div class="box">
    <div class="inbox">
      <div class="postleft">
      <dl>
        <dt><strong><ADDRESS><a href="profile.php?id=2">Rickard</a></ADDRESS></strong></dt>
 
        <dd class="usertitle"><strong>PunBB Developer</strong></dd>
        <dd class="postavatar"><img src="img/avatars/2.png" width="60" height="60" alt="" /></dd>
        <dd>From: 127.0.0.1</dd>
        <dd>Registered: 2001-11-02</dd>
        <dd>Posts: 7806</dd>
        <dd class="usercontacts"><a href="http://www.punbb.org/">Website</a></dd>


      </dl>
== Semantic HTML Design Principles ==
      </div>
<div id="Semantic_XHTML_Design_Principles">{{semantic-html-design-principles}}</div>
      <div class="postright">
      <h3>PunBB 1.2.9</h3>
      <div class="CONTENT postmsg">
        <p>Just a quick note this time....</p>
 
      </div>
      <div class="postsignature"><hr />&quot;Programming is like sex: ...</div>
      </div>
      <div class="clearer"></div>
      <div class="postfootleft"><p>Offline</p></div>
      <div class="postfootright"><div>&nbsp;</div></div>
    </div>
    </div>
 
  </div>
 
  <div id="p54392" class="ATOMENTRY blockpost roweven">
    <h2>
    <span><span class="conr">#2&nbsp;</span>
    <a REL="BOOKMARK" href="HTTP://FORUMS.PUNBB.ORG/viewtopic.php?pid=54392#p54392">
      <ABBR CLASS="POSTED" TITLE="20051016T1105441-0500">2005-10-16 10:54:41</ABBR>
    </a></span>
    </h2>
    <div class="box">
    <div class="inbox">
      <div class="postleft">
      <dl>
        <dt><strong><ADDRESS><a href="profile.php?id=5298">IdleFire</a></ADDRESS></strong></dt>
 
        <dd class="usertitle"><strong>Member</strong></dd>
        <dd class="postavatar"></dd>
        <dd>Registered: 2005-10-14</dd>
        <dd>Posts: 27</dd>
      </dl>
      </div>
      <div class="postright">
 
      <h3> Re: PunBB 1.2.9</h3>
      <div class="CONTENT postmsg">
        <p>...</p>
      </div>
      </div>
      <div class="clearer"></div>
      <div class="postfootleft"><p>Offline</p></div>
 
      <div class="postfootright"><div>&nbsp;</div></div>
    </div>
    </div>
  </div>
 
  ... more entries ...
 
  <div id="brdfooter" class="block">
    ... footer stuff ...
  </div>
 
  </div>
</div>
</body>
</nowiki></pre>
 
Changes:
*
Notes:
*
 
Questions:
* should the <code>address</code> enclose the entire author block?
 
=== More Examples ===
 
See [[hatom-examples]].
 
== Examples in the wild ==
This section is '''informative'''.
 
== Implementations ==
This section is '''informative'''.


== References ==
== References ==
=== Normative References ===
=== Normative References ===
* [http://www.w3.org/TR/2002/REC-xhtml1-20020801/ XHTML 1.0 SE]
* [http://www.w3.org/TR/2002/REC-xhtml1-20020801/ XHTML 1.0 SE]
* [http://www.atomenabled.org/ Atom]
* [http://www.ietf.org/rfc/rfc4287 RFC4287: The Atom Syndication Format]
* [[hcard-parsing]]
* [[rfc-2119|RFC 2119]]
* [[iso-8601|ISO8601]]


=== Informative References ===
=== Informative References ===
* [http://www.atomenabled.org/ atomenabled.org]


==== Specifications That Use hAtom ====
== Further Reading ==
 
* [http://www.ablognotlimited.com/articles/getting-semantic-with-microformats-part-5-hatom/ Getting Semantic With Microformats, Part 5: hAtom] by [http://www.ablognotlimited.com/ Emily Lewis]
==== Similar Work ====


== Work in progress ==
== Work in progress ==
Line 625: Line 207:


* [[blog-post-brainstorming|blog-post Brainstorming]]
* [[blog-post-brainstorming|blog-post Brainstorming]]
=== Version 0.1 ===
Version 0.1 was released 28 February 2006.


== Discussions ==
== Discussions ==
Line 634: Line 220:


=== Issues ===
=== Issues ===
* Please add any issues with the specification to the separate [[htom-issues|hAtom issues]] document.
* Please add any issues with the specification to the separate [[hatom-issues|hAtom issues]] document.


==See Also==
==See Also==
* [[hatom|hAtom]] - the draft proposal
{{hatom-related-pages}}
* [[hatom-issues]] - problems? complaints? ideas? Put them here
* [[rel-enclosure]] - how to semantically reference enclosures (e.g. podcasts) in hAtom
* [[hatom-faq]] - knowledge base
* [[blog-post-brainstorming]]
* [[blog-post-brainstorming]]
* [[blog-post-formats]]
* [[blog-post-formats]]
* [[blog-post-examples]]
* [[blog-post-examples]]
* [[blog-post-feed-equivalence]]
* [[blog-description-format]] - how to describe a blog (as opposed to the individual entries, which is what we're doing here)
* [[blog-description-format]] - how to describe a blog (as opposed to the individual entries, which is what we're doing here)
* [[xhtml-syndication]]
[[Category:Draft Specifications]]
[[Category:hAtom]]
== Translations ==
Read the hAtom draft specification in additional <span id="languages">languages</span>:
* [[hatom-fr|français]]

Latest revision as of 23:32, 20 June 2024

See latest version: h-entry

This document represents a draft microformat specification. Although drafts are somewhat mature in the development process, the stability of this document cannot be guaranteed, and implementers should be prepared to keep abreast of future developments and changes. Watch this wiki page, or follow discussions on the #microformats IRC channel to stay up-to-date.

hAtom is a microformat for content that can be syndicated, primarily but not exclusively weblog postings. hAtom is based on a subset of the Atom syndication format. hAtom will be one of several microformats open standards.

Draft Specification

Editor/Author
David Janes (BlogMatrix, Inc.)
Contributors
Benjamin Carlyle
Tantek Çelik (http://tantek.com/ and before at Technorati, Inc.)

copyright and patents statements apply.

Status

hAtom 0.1 is a microformats.org draft specification. Public discussion on hAtom takes place on hatom-feedback, the #microformats irc channel on irc.freenode.net, and microformats-discuss mailing list.

Available languages

The English version of this specification is the only normative version. For translations of this document see the #translations section.

Errata and Updates

Known errors and issues in this specification are corrected in resolved and closed issues. Please check there before reporting issues.

The hAtom 0.2 update is currently under development and incorporates known errata corrections as well as the value-class-pattern.

Introduction

hAtom is a microformat for identifying semantic information in weblog posts and practically any other place Atom may be used, such as news articles. hAtom content is easily added to most blogs by simple modifications to the blog's template definitions.

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Example

Here is a simple blog post example:

<article class="hentry">
  <h1 class="entry-title">Microformats are amazing</h1>
  <p>Published by <span class="author vcard"><span class="fn">W. Developer</span></span>
     on <time class="published" datetime="2013-06-13 12:00:00">13<sup>th</sup> June 2013</time></p>
  
  <p class="entry-summary">In which I extoll the virtues of using microformats.</p>
  
  <div class="entry-content">
    <p>Blah blah blah</p>
  </div>
</article>

Get started

The class hentry is a root class name that indicates the presence of an hAtom entry.

entry-title, author, published, entry-summary, entry-content and the other hAtom property classnames listed below define properties of the entry.

Format

In General

The Atom Syndication Format provides the conceptual basis for this microformat, with the following caveats:

  • Atom provides a lot more functionality than we need for a "blog post" microformat, so we've taken the minimal number of elements needed.
  • the "logical" model of hAtom is that of Atom. If there is a conflict, Atom should be taken as correct.
  • the "physical" model of hAtom -- the actual writing of elements -- is a lot more varied than Atom provides for, due to the variety of ways weblogs are actually produced in the wild. The hAtom microformat provides a number of rules for "bridging the gap"

Schema

Schema elements are based on the Atom nomenclature and follow the microformat pattern of prefixing a unique identifier (in this case, 'h') on the outermost container elements -- the Feed or Entry. The parts of this microformat are based on analysis of many weblog, bulletin board and media posts and can be read blog-post-brainstorming#Discovered_Elements.

The hAtom schema consists of the following:

[*] Some required elements have defaults if missing, see below.

Field and Element Details

Feed
  • a Feed element is identified by the class name hfeed
  • a Feed element represents the concept of an Atom feed
  • the Feed element is optional and, if missing, is assumed to be the page
  • hAtom documents MAY have multiple Feed elements
Feed Category
  • a Feed Category element is identified by rel-tag
  • a Feed MAY have a Feed Category
  • a Feed Category element represents the concept of an Atom category inside a feed
  • Feed Category elements MUST appear inside a Feed element but not inside an Entry element
  • the rel-tag href encodes the atom category:term; the link text defines the atom category:label
Entry
  • an Entry element is identified by class name hentry
  • an Entry element represents the concept of an Atom entry
  • any microformat content inside a <blockquote> or <q> element within the Entry should not be considered part of the Entry.
This allows quoting other microformated data without worry of corrupting the model
Entry Category
  • an Entry Category element is identified by rel-tag
  • an Entry MAY have an Entry Category
  • an Entry Category element represents the concept of an Atom category inside an entry
  • the rel-tag href encodes the atom category:term; the link text defines the atom category:label
Entry Title
  • an Entry Title element is identified by the class name entry-title
  • an Entry SHOULD have an Entry Title
  • an Entry Title element represents the concept of an Atom entry title
  • if the Entry Title is missing, use
    • the first <h#> element in the Entry, or
    • the <title> of the page, if there is no enclosing Feed element, or
    • assume it is the empty string
Entry Content
  • an Entry Content element is identified by class name entry-content
  • an Entry SHOULD have Entry Content
  • an Entry Content element represents the concept of an Atom content
  • an Entry MAY have 0 or more Entry Content elements. The "logical Entry Content" of an Entry is the concatenation, in order of appearance, of all the Entry Contents within the Entry
Many web logs split content into multiple sections with a "Read More" link and JavaScript tricks. This is also needed in cases where Entry Titles are coded in-line and are considered part of the content.
  • if the Entry Content is missing, assume it is the empty string
Entry Summary
  • an Entry Summary element is identified by class name entry-summary
  • an Entry Summary element represents the concept of an Atom summary
  • an Entry MAY have 0 or more Entry Summary elements. The "logical Entry Summary" of an Entry is the concatenation, in order of appearance, of all the Entry Summarys within the Entry
Entry Permalink
  • an Entry Permalink element is identified by rel-bookmark
  • an Entry SHOULD have an Entry Permalink
  • an Entry Permalink element represents the concept of an Atom link in an entry
  • if the Entry Permalink is missing, use the URI of the page; if the Entry has an "id" attribute, add that as a fragment to the page URI to distinguish individual entries
Entry Updated
  • an Entry Updated element is identified by class name updated
  • an Entry Updated element represents the concept of Atom updated
  • an Entry SHOULD have an Entry Updated element
  • use the value class pattern date and time to encode the updated datetime
  • if there is no Entry Updated element,
    • use the Entry Published element, if present
    • otherwise the page is invalid hAtom
Entry Published
Entry Author
  • an Entry Author element is represented by class name author
  • an Entry Author element represents the concept of an Atom author
  • an Entry Author element MUST be encoded in an hCard
  • an Entry Author element SHOULD be encoded in an <address> element
  • an Entry SHOULD have at least one Entry Author element
  • an Entry MAY have more than one Entry Author elements
  • if the Entry Author is missing
    • find the Nearest In Parent <address> element(s) with class name author and that is/are a valid hCard
    • otherwise the entry is invalid hAtom

XMDP Profile

See hatom-profile.

Examples

See hatom-examples.

Examples in the wild

See hatom-examples-in-wild.

Implementations

See hatom-implementations.

Copyright

This specification is (C) 2005-2024 by the authors. However, the authors intend to submit (or already have submitted, see details in the spec) this specification to a standards body with a liberal copyright/licensing policy such as the GMPG, IETF, and/or W3C. Anyone wishing to contribute should read their copyright principles, policies and licenses (e.g. the GMPG Principles) and agree to them, including licensing of all contributions under all required licenses (e.g. CC-by 1.0 and later), before contributing.

  • Tantek: I release all my contributions to this specification into the public domain and I encourage the other authors to do so as well.
    • When all authors/editors have done so, we can remove the MicroFormatCopyrightStatement template reference and replace it with the MicroFormatPublicDomainContributionStatement.

Patents

This specification is subject to a royalty free patent policy, e.g. per the W3C Patent Policy, and IETF RFC3667 & RFC3668.

Semantic HTML Design Principles

  1. Reuse the schema (names, objects, properties, values, types, hierarchies, constraints) as much as possible from pre-existing, established, well-supported microformats.
  2. When new schema are needed, reuse the schema (names, objects, properties, values, types, hierarchies, constraints) as much as possible from pre-existing, established, well-supported other formats/standards by incorporation, following the microformats naming-principles. Re-do constraints expressed in the source standard from the perspective of microformats design principles and designed primarily for web authoring. Informatively mention source standard for reference purposes.
    1. For types with multiple components, use nested elements with class names equivalent to the names of the components.
    2. Plural components are made singular, and thus multiple nested elements are used to represent multiple text values that are comma-delimited.
  3. Use the most accurately precise semantic HTML building block for each object etc.
  4. Otherwise use a generic structural element (e.g. <span> or <div>), or the appropriate contextual element (e.g. an <li> inside a <ul> or <ol>).
  5. Use class names based on names from the original schema, unless the semantic HTML building block precisely represents that part of the original schema. If names in the source schema are case-insensitive, then use an all lowercase equivalent. Components names implicit in prose (rather than explicit in the defined schema) should also use lowercase equivalents for ease of use. Spaces in component names become dash '-' characters.
  6. Finally, if the format of the data according to the original schema is too long but still human readable/listenable, use <abbr> instead of a generic structural element, and place the literal longer data into the 'title' attribute (where abbr expansions go), and the briefer equivalent into the contents of the element itself. If however, the format of the literal longer data data is not human-friendly, instead of <abbr>, use the value-class-pattern or HTML5 <time>/<data> elements as most semantically appropriate.

References

Normative References

Informative References

Further Reading

Work in progress

This specification is a work in progress. As additional aspects are discussed, understood, and written, they will be added. There is a separate document where we are keeping our brainstorms and other explorations relating to hAtom:

Version 0.1

Version 0.1 was released 28 February 2006.

Discussions

Q&A

  • If you have any questions about hAtom, check the hAtom FAQ, and if you don't find answers, add your questions!

Issues

  • Please add any issues with the specification to the separate hAtom issues document.

See Also

Translations

Read the hAtom draft specification in additional languages: