This article is a stub. You can help the IndieWebCamp wiki by expanding it.
authorship is a claim about who the author(s) of a post are.
How to determine authorship of a post on a page - AKA the Authorship discovery algorithm / processing model for implementations.
- start with a particular
h-entry to determine authorship for, and no
author. if no
h-entry, then there's no post to find authorship for, abort.
- parse the
- if the
h-entry has an
author property, use that
- otherwise if the h-entry has a parent
author property, use that
- if an
author property was found
- if it has an h-card, use it, exit.
- otherwise if
author property is an
http(s) URL, let the author-page have that URL
- otherwise use the
author property as the author name, exit
- if there is no author-page and the
h-entry's page is a permalink page, then
- if the page has a rel-author link, let the author-page's URL be the href of the rel-author link
- if there is an author-page URL
- get the author-page from that URL and parse it for microformats2
- if author-page has 1+
uid == author-page's URL, then use first such
- else if author-page has 1+
url property which matches the
href of a rel-me link on the author-page (perhaps the same hyperlink element as the u-url, though not required to be), use first such
- if the
h-entry's page has 1+
url == author-page URL, use first such
- otherwise no deterministic author can be found. Implementations are encouraged to document additional heuristics below for consideration for incorporation in to the authorship algorithm.
Note: the steps of checking for "url == uid == page's URL" and "url that's also a rel-me" were incorporated inline from the steps for parsing a representative h-card. Some improvements have been made here due to feedback from implementations in practice, and those improvements should be incorporated into an iteration of representative h-card.
- HTML files for testing out the above Authorship Algorithm (replace raw.github.com with rawgithub.com to serve the pages with text/html):
Authorship can potentially be spoofed, as the current algorithm may only look at the markup
within an arbitrary page to determine the author.
For example, any page with markup like http://paste.debian.net/plainh/587c8bb3 would be parsed as being written by Barnaby Walters. Examples of such spoofing are
was not actually written by aaronpk, but posted on a debian pastebin site and linked via a webmention.
is similarly spoofed.
http://checkmention.appspot.com allows you to test receiving a spoofed webmention from Jonathan Ive.
Theoretical issues are grouped here for capturing purposes. If you find a real world example of one of these, feel free to promote it to an actual issue with its own === subhead.
- string-only author: What to do if page h-entry has an author property which is not an h-card, but a string? Treat as empty and continue to fallback methods?
- This probably isn’t worth discussing much as I can’t find a single example of this in the wild, but as it’s supported in the h-entry spec (“optionally embedded h-card(s)) it might be worth considering/specifying for when it does happen --Barnaby Walters 15:26, 17 January 2014 (PST)
In comments-presentation, it describes how a site that accepts indieweb reply posts via webmention can retrieve those replies and display them as full-fledged comments on a post, including name and icon/avatar of commenter.
h-card is the most common way that name, URL, photo information is published about a person on the web. Thus parsing for an author's h-card to retrieve their name and avatar makes the most sense.
Algorithm Design Notes
Why do we parse for the authorship details in the order that we do?
First, we prefer the p-author of the h-entry first because that is the most direct way of specifying the information, visibly, on the page. There's also established practice among indieweb sites of publishing a mini h-card with photo, name (sometimes as the alt text of the photo img), and URL to the person's indieweb site root / home page. Also, it may be possible that the post is a guest post, in which case we really want the post-specific authorship information rather than anything general to the site.
Only if the post itself lacks direct authorship information do we fall back to checking for a rel-author link, which is a fairly well established practice for linking from posts to pages representing authors.
On such sites that use rel-author, they almost always point to a page that has a much richer h-card about the author than the post page itself, including a much higher likelihood of having a good photo / avatar image as part of that h-card. Thus we next prefer to go retrieve that rel-author destination, and look for a representative h-card there (per the "url == uid == page's URL" and "url that's also a rel-me" steps noted above).
Only if the rel-author page lacks an h-card do we then fallback to looking for a likely smaller (if present) h-card on the post page itself that has a u-url of the same value as the destination of the rel-author, thus indicating that it is an h-card for the author.
php mf2 getAuthor
barnabywalters/mf-cleaner getAuthor() implements several extra steps whilst missing out the steps above which require fetching another URL — at the moment getAuthor completely lacks side effects:
- If the given h-entry has an author or reviewer (for compat. with h-review if it doesn’t become more consistent with h-entry) property:
- if the found value is a string, search all the h-cards on the page for one with a name property equal to the found value, and return it
- If the found value is a microformat, return it
- Look for page-scoped rel-author, search all the h-cards on the page for one with a url property equal to the first rel-author value — if found, return it
- If a page URL is given, or the h-entry has a url property, search all h-cards on the page for one where the domain of their url property is the same as the domain of the found url — if found return that
- Otherwise return the first found h-card on the page, or null
Google's search spider supports only part of the authorship algorithm, rel=author, in an oddly silo-specific way:
- if there's
rel=author link on a page
- if it links to a Google+ profile, use that profile for authorship information
- if it links to a home page
- if the home page has a
rel=me link to a Google+ profile
- and the Google+ profile has
rel=contributor-to link back to the home page
- then use that profile for authorship information