hatom: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
m (→‎Parsing Details: killing empty section)
(s/<source>/<syntaxhighlight>/)
 
(217 intermediate revisions by 63 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 based on a subset of the [http://www.atomenabled.org/ Atom] syndication format.
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 ==


This microformat is a draft; please address your concerns, issues, comments, etc. in [[hatom-issues]].
<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/Author ===
== 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].


=== Contributors ===
=== Available languages ===
* [http://members.optusnet.com.au/benjamincarlyle/benjamin/blog/ Benjamin Carlyle]
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.
{{rfc-2119-intro}}


== Semantic XHTML Design Principles ==
== Example ==
{{semantic-xhtml-design-principles}}
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 ==
Line 30: Line 60:
The [http://atomenabled.org/developers/syndication/#person Atom Syndication Format] provides the conceptual basis for this microformat, with the following caveats:
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 that we need for a "blog post" microformat, so we've taken the minimal number of elements needed. This can (and probably should) be expanded.
* 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 "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 "briding the gap"
* 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"
:: ''for example, if an entry is missing an author (required by Atom), it is assumed to be that of the XHTML page''


=== Schema ===
=== Schema ===
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]]. 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 ====


'''Note:''' Please see the [[hatom-issues]] document for discussion on property names.
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="hfeed"</code>
*** '''<code>author</code>'''. required using '''[[hcard|hCard]]'''. [*]
|-
*** '''<code>bookmark</code>''' (permalink). optional, using '''[[rel-bookmark]]'''.
| Entry
*** tags. optional. keywords or phrases, using '''[[rel-tag]]'''.
| <code>atom:entry</code>
| Add class name <code>hentry</code>; if practical, also define <code>id="unique-identifier"</code> to the Entry.
|-
| Entry Title
| <code>atom:title</code>
| Add class name <code>headline</code>. Using <code>&lt;h#></code> also is encouraged.
|-
| Entry Content
| <code>atom:content</code>
| Add class name <code>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 class name <code>excerpt</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 a rel value of <code>bookmark</code>.
|-
| Entry Published
| <code>atom:published</code>
| Use class name <code>published</code>, optionally with the [[datetime-design-pattern]].
|-
| Entry Updated
| <code>atom:updated</code>
| Use class name<code>updated</code>, with an ISO8601 absolute datetime, optionally with the [[datetime-design-pattern]].
|-
| Entry Author
| <code>atom:author</code>
| Add class name <code>"author</code>. Using an <code>address</code> element is recommended. A [[hcard|hCard]] SHOULD be added.
|}


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


{| width="100%" border="1" cellspacing="0"
=== Field and Element Details ===
|-
! Concept
! Nests In
! hAtom Opaque
! Cardinality
! Logical Cardinality<br /><i>Informative</i>
|-
| Feed
| HTML document
| No
| 1-N
| 1-N
|-
| Entry
| Feed
| No
| 0-N
| 0-N
|-
| Entry Title
| Entry<br />Entry Permalink
| No
| 0-N
| 0-1
|-
| Entry Content
| Entry
| Yes
| 0-N
| 0-1
|-
| Entry Summary
| Entry
| Yes
| 0-N
| 0-1
|-
| Entry Permalink
| Entry<br />Entry Title<br />Entry Published
| No
| 0-N
| 1
|-
| Entry Published
| Entry<br />Entry Permalink
| No
| 0-N
| 0-1
|-
| Entry Updated
| Entry<br />Entry Permalink
| No
| 0-N
| 1
|-
| Entry Author
| Entry
| Yes
| 0-N
| 1-N
|}
 
===== hAtom Opaque =====
 
"hAtom Opaque" specifies whether a hAtom parser should not "look inside" the element for further hAtom content. If there are multiple rules applied to the same element take the OR of the two (i.e. "Yes/Opaque" always wins)
 
: ''hAtom Opaque is designed to make parsing rules less ambiguous. In particular, it allows "quoted" hAtom elements (from another blog being blockquoted, for example) ti be ignored. It also allows 'embedded' hAtom to be potentially delivered within hAtom itself, and to prevent accidental 'leaking' of other microformat information up into the hAtom container. A general concept of opaqueness (<b>need link</b>) has also been proposed but it will complement, not replace this.''
 
===== Cardinality =====
 
How many times can an element of the given type appear in it's nesting/parent element.
 
===== Logical Cardinality =====
 
''This column is informative -- Atom has a number of rules for deciding what is required depending on the context and other elements, many which aren't strictly applicable to here.''
 
From a modeling/logical perspective, the number of times can an element appear.
 
: ''This is all rule dependent, see below. For example, an Entry Permalink may appear 6 times, but each one must be the same value; an Entry Content element may appear 3 times, but they are all concatenated together to make a single logical element.''
 
 
 
==== Rules and Definitions ====
See the [[#Nesting_Rules|Nesting Rules]] section above for placement of these elements.


===== Feed =====
===== Feed =====
* an XHTML Feed element is identified by the class name <code>hfeed</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
* the Feed element is required, even if there is a single Entry
* hAtom documents {{may}} have multiple Feed elements
* hAtom documents MAY have multiple, non-nested Feed elements
: ''This may happen on news pages, or weblogs with "mini-blogs" on the sidebar.''


DavidJanes: ''We need to work on this section. Is hfeed always going to be required?''
===== 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 [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>


===== Entry =====
===== Entry =====
* an Entry element is identified by <code>class="hentry"</code>
* 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]
* 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]
* a weblog entry MUST be enclosed in a single Entry element
* 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.
* an Entry MUST have an enclosing Feed element
: ''This allows quoting other microformated data without worry of corrupting the model''
* ''This enclosing element can be the same as the Entry -- i.e. class="hfeed hentry" is OK for feeds with a single entry.''
 
===== 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 [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]
* the [[rel-tag]] <code>href</code> encodes the atom <code>category:term</code>; the link text defines the atom <code>category:label</code>


===== Entry Title =====
===== Entry Title =====
* an Entry Title element is identified by the class name <code>headline</code>
* an Entry Title element is identified by the class name <code>entry-title</code>
* an Entry Title element alternately be identified by <code>&lt;h#></code>
* 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]
* 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
====== Disambiguation ======
** 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
* the first hAtom valid element with a class name of <code>headline</code> is the Entry Title
** assume it is the empty string
: ''hAtom valid meaning somewhere where we expect it (like not inside Entry Content, for example).''
* otherwise, the first hAtom valid <code>&lt;h#></code> element to appear in an hAtom document is the Entry Title
* otherwise, the Entry Title is the empty string
: ''Atom does not allow for an entry not to have a title.''


===== Entry Content =====
===== Entry Content =====
* an Entry Content element is identified by <code>class="content"</code>
* an Entry Content element is identified by class name <code>entry-content</code>
* an 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 MAY have 0 or more Entry Content elements
* an Entry Content element represents the concept of an [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#atomContent Atom content]
: ''We recognize this varies from the Atom spec: see the next rule.''
* 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
* 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.''
: ''Many weblogs split content into multiple sections with a "Read More" link and javascript tricks. This is also needed in cases where Entry Titles are coded inline and are considered part of the content.''
* if the Entry Content is missing, assume it is the empty string
* the "logical Entry Content" MUST be complete; that is, contain the entire content of the Entry
: ''Otherwise it should be marked as Entry Summary.''


===== Entry Summary =====
===== Entry Summary =====
* an Entry Summary element is identified by <code>class="excerpt"</code>
* an Entry Summary element is identified by class name <code>entry-summary</code>
* 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 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
* 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
: ''We recognize this varies from the Atom spec: see the next rule.''
* 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 Entry Permalink element is identified by <code>rel="bookmark"</code>
* an Entry Permalink element is identified by [[rel-bookmark]]
* 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]
* an Entry {{should}} have an Entry Permalink
* Entry Permalinks SHOULD be absolute URIs
* 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]
* Entry Permalinks MUST be the same as the <code>atom:link</code> (or <code>rss:link</code>) used in syndication feeds
* 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
: ''The intention of the previous two rules to gently force people to use strings that can be byte compared for equivalence. In general, the canonical URI should be the link used in an Atom entry.''
* if an Entry has multiple elements marked as the Entry Permalink, they MUST have exactly the same URI
* an Entry SHOULD have an Entry Permalink
* there can be at most 1 Entry in an XHTML document without an Entry Permalink; the Entry Permalink of this Entry is the URI of the page
: ''This rule is needed for media pages (i.e. a news article on cnn.com). There is some ugliness of with this because the URI could be non-canonical.''


====== Disambiguation ======
===== Entry Updated =====
* The first valid element in an Entry marked as an Entry Permalink is the Entry Permalink
* 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 Entry Published element is identified by the class name <code>published</code>
* an Entry Published element is identified by <code>class="published"</code>
* 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]
* a 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
* the machine readable datetime should be encoded with an <code>&lt;abbr></code> element using the [[datetime-design-pattern]]; the machine readable datetime should be complete, that is, specified to the second with the timezone included
: ''This is to be consistent with the [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.3.3 Atom Datetime Construct].
* optionally, this can be specified by an HTML element with the ISO datetime in the text.
: ''This is a little uglier for the reader, but it's possible.''
 
====== Disambiguation ======
 
* The first valid element in an Entry marked as an Entry Published is the Entry Published element
 
===== Entry Updated =====
 
* an Entry Updated element is identified by <code>class="updated"</code>
* a Entry Updated element represents the concept of [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.15 atom updated]
* the machine readable datetime should be encoded with an <code>&lt;abbr></code> element using the [[datetime-design-pattern]]; the machine readable datetime should be complete, that is, specified to the second with the timezone included
: ''This is to be consistent with the [http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.3.3 Atom Datetime Construct].
* if there is no Entry Updated element, the value is assumed to be that of Entry Published
: ''Entry Published is more often available in weblog templates, so we're going with that.''
* if there is no Entry Updated and Entry Published elements, transformation to Atom is problematic
: ''This is because a published element is required. Suggestions would be appreciated here.''
* optionally, this can be specified by an HTML element with the ISO datetime in the text.
: ''This is a little uglier for the reader, but it's possible.''
 
====== Disambiguation ======
 
* The first valid element in an Entry marked as an Entry Updated is the Entry Updated element


===== Entry Author =====
===== Entry Author =====
 
* an Entry Author element is represented by class name <code>author</code>
* an Entry Author element is represented by <code>class="author"</code>
* 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 SHOULD use an XHTML <code>&lt;address></code> element
* an Entry Author element {{must}} be encoded in an [[hcard|hCard]]
* 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 {{should}} be encoded in an <code>&lt;address></code> element
* an Entry Author element SHOULD contain an [[hcard|hCard]]
* an Entry {{should}} have at least one Entry Author element
: ''If it does not, just consider the text to effectively be the FN. hReview also considers a hCard to be a SHOULD, not a MUST.''
* an Entry {{may}} have more than one Entry Author elements
* an Entry MAY have 0 or more Entry Author elements
* if the Entry Author is missing
* if an Entry has 0 Entry Author elements, the "logical Entry Author" is assumed to be the author of the XHTML page
** 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]]
: ''Atom requires at least one Author''
** otherwise the entry is invalid hAtom
 
==== Categories and Tags ====
 
''This section needs a lot more work.''
 
* Entry categories and tagging are represented by [[rel-tag]]
* [[rel-tag]] elements may appear anywhere within a Entry, including Entry Content. This is the one case where we break opacity.


=== XMDP Profile ===
=== XMDP Profile ===
<pre>
See [[hatom-profile]].
<dl class="profile">
<dt>class</dt>
<dd><p>
  <a rel="help" href="http://www.w3.org/TR/html401/struct/global.html#adef-class">
  HTML4 definition of the 'class' attribute.</a>
  This meta data profile defines some 'class' attribute values (class names)
  and their meanings as suggested by a
  <a href="http://www.w3.org/TR/WD-htmllink-970328#profile">
  draft of "Hypertext Links in HTML"</a>.
  <dl>
  <dt>hfeed</dt>
  <dd>
    The concept of atom:feed from
    <a href="http://www.atomenabled.org/developers/syndication/atom-format-spec.php">The Atom Syndication Format</a>,
    constrained and modified as per the <a href="http://microformats.org/wiki/hatom">hAtom microformat spec</a>.
  </dd>
  <dt>hentry</dt>
  <dd>
    The concept of atom:entry from
    <a href="http://www.atomenabled.org/developers/syndication/atom-format-spec.php">The Atom Syndication Format</a>,
    constrained and modified as per the <a href="http://microformats.org/wiki/hatom">hAtom microformat spec</a>.
  </dd>
  <dt>content</dt>
  <dd>
    The concept of atom:content from
    <a href="http://www.atomenabled.org/developers/syndication/atom-format-spec.php">The Atom Syndication Format</a>,
    constrained and modified as per the <a href="http://microformats.org/wiki/hatom">hAtom microformat spec</a>.
  </dd>
  <dt>excerpt</dt>
  <dd>
    The concept of atom:summary from
    <a href="http://www.atomenabled.org/developers/syndication/atom-format-spec.php">The Atom Syndication Format</a>,
    constrained and modified as per the <a href="http://microformats.org/wiki/hatom">hAtom microformat spec</a>.
  </dd>
  <dt>bookmark</dt>
  <dd>
    The concept of atom:link (without any "rel") with an atom:entry from
    <a href="http://www.atomenabled.org/developers/syndication/atom-format-spec.php">The Atom Syndication Format</a>,
    constrained and modified as per the <a href="http://microformats.org/wiki/hatom">hAtom microformat spec</a>.
  </dd>
  <dt>published</dt>
  <dd>
    The concept of atom:published from
    <a href="http://www.atomenabled.org/developers/syndication/atom-format-spec.php">The Atom Syndication Format</a>,
    constrained and modified as per the <a href="http://microformats.org/wiki/hatom">hAtom microformat spec</a>.
  </dd>
  <dt>updated</dt>
  <dd>
    The concept of atom:updatedfrom
    <a href="http://www.atomenabled.org/developers/syndication/atom-format-spec.php">The Atom Syndication Format</a>,
    constrained and modified as per the <a href="http://microformats.org/wiki/hatom">hAtom microformat spec</a>.
  </dd>
  <dt>author</dt>
  <dd>
    The concept of atom:author from
    <a href="http://www.atomenabled.org/developers/syndication/atom-format-spec.php">The Atom Syndication Format</a>,
    constrained and modified as per the <a href="http://microformats.org/wiki/hatom">hAtom microformat spec</a>.
  </dd>
  </dl>
</dd>
</dl>
</pre>
 
 


== Examples ==
== Examples ==
Line 353: Line 170:
See [[hatom-examples]].
See [[hatom-examples]].


== Examples in the wild ==
=== Examples in the wild ===
This section is '''informative'''.


* [http://blog.davidjanes.com Ranting and Roaring] (David Janes)
See [[hatom-examples-in-wild]].
* [http://www.myelin.co.nz/post/ Second p0st] (Phil Pearson)
* [http://members.optusnet.com.au/benjamincarlyle/benjamin/blog/ Sound Advice] (Benjamin Carlyle)
* [http://sedna.spip.org/sedna/ Sedna RSS] (a feed aggregator based on SPIP, by Fil, IZO and others; GPLd sources are available at [http://zone.spip.org/trac/spip-zone/browser/_squelettes_/sedna SPIP-Zone])


== Implementations ==
== Implementations ==


This section is '''informative'''.
See [[hatom-implementations]].


* the [http://www.trinityanne.com/tools/extract/ Almost Universal Microformat Parser] can extract hAtom content from webpages ([http://www.trinityanne.com/tools/extract/?uri=http%3A%2F%2Fblog.davidjanes.com&microformat=hatom&submit=Submit example])
== Copyright ==
* the [http://www.trinityanne.com/tools/greasemonkey/microformat-action.user.js microformat-action] [[greasemonkey|Greasemonkey]] script detects hAtom content on webpages and will call the [http://www.trinityanne.com/tools/extract/ Almost Universal Microformat Parser]
{{MicroFormatCopyrightStatement2005}}
* the [http://www.blogmatrix.com/tools/rewrite/ hAtom Template Rewriter] converts Blogger, MovableType and Wordpress templates into hAtom compatible ones -- (hopefully) without presentation impact
* [[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.
* An [http://lukearno.com/projects/hAtom/ hAtom-2-Atom] XSLT is available. (This version is currently broken but a working version is [http://rbach.priv.at/repos/hatom/hatom2atom.xsl/trunk/ available])
** When all authors/editors have done so, we can remove the MicroFormatCopyrightStatement template reference and replace it with the MicroFormatPublicDomainContributionStatement.
 
== Patents ==
{{MicroFormatPatentStatement}}
 
== Semantic HTML Design Principles ==
<div id="Semantic_XHTML_Design_Principles">{{semantic-html-design-principles}}</div>


== 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]]
* [[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 ====
 
* [http://rdfs.org/sioc/ Semantically-Interlinked Online Communities (SIOC) RDF Ontology]


== Work in progress ==
== Work in progress ==
Line 389: Line 208:
* [[blog-post-brainstorming|blog-post Brainstorming]]
* [[blog-post-brainstorming|blog-post Brainstorming]]


== Hints and Tips ==
=== Version 0.1 ===
 
=== CSS tips ===
HTML typically styles <code>address</code> as a block level element in an italic font. This will make it inline and plain within hAtom elements:
 
<pre><nowiki>
.entry address {
    display: inline;
    font-weight: normal;
    font-style: normal;
}
</nowiki></pre>
 
HTML typically puts a dotted line under <code>&lt;abbr></code> elements. This will put postage paid to that for Entry Updated and Entry Posted:
 
<pre><nowiki>
.entry abbr.updated, .entry abbr.posted {
  font-style: normal;
  border: none;
}
</nowiki></pre>
 
=== MovableType Template ===
 
A datetime encoded in an ABBR element can be produced with the following template code:


<pre><nowiki>
Version 0.1 was released 28 February 2006.
<abbr
class="posted"
title="<$MTEntryDate format="%Y%m%dT%H%M%S"$><$MTBlogTimezone
no_colon="1"$>"><$MTEntryDate format="%X"$></abbr>
</nowiki></pre>


== Discussions ==
== Discussions ==
Line 431: Line 221:
=== Issues ===
=== Issues ===
* Please add any issues with the specification to the separate [[hatom-issues|hAtom issues]] document.
* Please add any issues with the specification to the separate [[hatom-issues|hAtom issues]] document.
== Recent Changes ==
''Most recent at top please. This section will eventually be removed but should be helpful for people tracking changes during specing.''
* Entry Permalink now SHOULD (as opposed to MUST) be a complete URI
* Entry Title now preferentially uses class="title"
* Entry Author most explicitly be marked class="author"
* using an <code>&lt;address</code> around Entry Author and Entry Contributor is no longer required


==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: