h-card-examples: Difference between revisions
GRegorLove (talk | contribs) (first example, removed <address> and spec reference to simplify from hCard) |
GRegorLove (talk | contribs) (→Instructive Examples: References to People and Organizations) |
||
Line 19: | Line 19: | ||
Note that when this example is parsed, the <code>u-url</code> property will be automatically implied. For more information, see [[microformats-2-implied-properties]]. | Note that when this example is parsed, the <code>u-url</code> property will be automatically implied. For more information, see [[microformats-2-implied-properties]]. | ||
=== References to People and Organizations === | |||
A common pattern in blog posts is to link mentions of people's names to their blogs, and/or organizations to their home pages. E.g.: | |||
<pre><nowiki> | |||
<a href="http://meyerweb.com/">Eric Meyer</a> wrote a post | |||
(<a href="http://meyerweb.com/eric/thoughts/2005/12/16/tax-relief/">Tax Relief</a>) | |||
about an unintentionally humorous letter he received from the | |||
<a href="http://irs.gov/">Internal Revenue Service</a>. | |||
</nowiki></pre> | |||
By adding [[h-card]] to such markup, you can explicitly indicate both the person and the organization by name and URL: | |||
<pre><nowiki> | |||
<a href="http://meyerweb.com/" class="h-card">Eric Meyer</a> wrote a post | |||
(<a href="http://meyerweb.com/eric/thoughts/2005/12/16/tax-relief/">Tax Relief</a>) | |||
about an unintentionally humorous letter he received from the | |||
<a href="http://irs.gov/" class="h-card">Internal Revenue Service</a>. | |||
</nowiki></pre> | |||
This could be displayed as: | |||
''[http://meyerweb.com/ Eric Meyer]'' wrote a post (''[http://meyerweb.com/eric/thoughts/2005/12/16/tax-relief/ Tax Relief]'') about an unintentionally | |||
humorous letter he received from the [http://irs.gov/ Internal Revenue Service]. | |||
==== a person who works for an organization ==== | |||
People often associate themselves with a company or organization that they work for. E.g. | |||
<pre><nowiki> | |||
<span class="h-card"> | |||
<span class="p-name">Jeremy Keith</span>, | |||
<span class="p-org">Clearleft</span> | |||
</span> | |||
</nowiki></pre> | |||
Of course in this day and age, nearly everybody has a URL both for themselves and for their company. It's easy to add a URL for the person in the above [[h-card]] example: | |||
<pre><nowiki> | |||
<span class="h-card"> | |||
<a class="p-name u-url" href="http://adactio.com/">Jeremy Keith</a>, | |||
<span class="p-org">Clearleft</span> | |||
</span> | |||
</nowiki></pre> | |||
But to add a URL to the company, there is no "org-url" property (nor should there be), instead, use modularity and a nested h-card for the company itself: | |||
<pre><nowiki> | |||
<span class="h-card"> | |||
<a class="p-name u-url" href="http://adactio.com/">Jeremy Keith</a>, | |||
<span class="p-org h-card"><a class="p-name u-url" href="http://clearleft.com">Clearleft</a></span> | |||
</span> | |||
</nowiki></pre> | |||
== See Also == | == See Also == | ||
* [[h-card]] | * [[h-card]] |
Revision as of 03:17, 10 May 2017
This article is a stub. You can help the microformats.org wiki by expanding it. - consider picking the best and most useful examples from hcard-examples, upgrading them to mf2, and adding them here below.
h-card examples is for particularly interesting and illustrative examples of h-card markup.
Instructive Examples
Authors of Pages and Posts
Author's probably have at least their name listed on a page or post. You may also have a link. E.g.
<a href="http://tantek.com">Tantek Çelik</a>
By adding h-card to such existing HTML, you can explicitly indicate the author's name and web address:
<a href="http://tantek.com" class="h-card">Tantek Çelik</a>
This could be displayed as:
Tantek Çelik
Note that when this example is parsed, the u-url
property will be automatically implied. For more information, see microformats-2-implied-properties.
References to People and Organizations
A common pattern in blog posts is to link mentions of people's names to their blogs, and/or organizations to their home pages. E.g.:
<a href="http://meyerweb.com/">Eric Meyer</a> wrote a post (<a href="http://meyerweb.com/eric/thoughts/2005/12/16/tax-relief/">Tax Relief</a>) about an unintentionally humorous letter he received from the <a href="http://irs.gov/">Internal Revenue Service</a>.
By adding h-card to such markup, you can explicitly indicate both the person and the organization by name and URL:
<a href="http://meyerweb.com/" class="h-card">Eric Meyer</a> wrote a post (<a href="http://meyerweb.com/eric/thoughts/2005/12/16/tax-relief/">Tax Relief</a>) about an unintentionally humorous letter he received from the <a href="http://irs.gov/" class="h-card">Internal Revenue Service</a>.
This could be displayed as:
Eric Meyer wrote a post (Tax Relief) about an unintentionally humorous letter he received from the Internal Revenue Service.
a person who works for an organization
People often associate themselves with a company or organization that they work for. E.g.
<span class="h-card"> <span class="p-name">Jeremy Keith</span>, <span class="p-org">Clearleft</span> </span>
Of course in this day and age, nearly everybody has a URL both for themselves and for their company. It's easy to add a URL for the person in the above h-card example:
<span class="h-card"> <a class="p-name u-url" href="http://adactio.com/">Jeremy Keith</a>, <span class="p-org">Clearleft</span> </span>
But to add a URL to the company, there is no "org-url" property (nor should there be), instead, use modularity and a nested h-card for the company itself:
<span class="h-card"> <a class="p-name u-url" href="http://adactio.com/">Jeremy Keith</a>, <span class="p-org h-card"><a class="p-name u-url" href="http://clearleft.com">Clearleft</a></span> </span>