authorship

From IndieWeb
Jump to: navigation, search

authorship is how to determine who the author(s) of a post are.

Contents

Why

If you write code which consumes h-entry, e.g. your CMS receives Webmentions and you parse the source for post information including who the author is, authorship is how you determine from that information who the author(s) is/are.

How to

How to publish

Publishing your authorship of a post is designed to be both easy and flexible to adapt to a variety of publishing methods and designs. Any of the following are fine.

Choose whichever is the least work for you, your site, your theme(s), your code, and easiest for you to maintain!

posts:

  • h-entry markup on your posts including an explicit p-author or u-author (can be enhanced with an h-card)
  • OR rel-author link from your post to e.g. your home page where you have an h-card about you

streams of posts (like on an archive, homepage, etc.) without explicit authorship per post:

  • h-feed markup including an explicit p-author or u-author (can be enhanced with an h-card)
  • OR rel-author link from your stream page to e.g. your home page where you have an h-card about you.

separate author description pages (e.g. when using u-author or rel=author)

  • h-card with information about you on your author description page (e.g. homepage)

Validate! Try this tool to validate your authorship markup - it will tell you how the authorship algorithm finds your author information on a permalink:

How to determine

How to determine authorship of a post on a page - AKA the Authorship discovery algorithm / processing model for implementations.

  1. 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.
  2. parse the h-entry
  3. if the h-entry has an author property, use that
  4. otherwise if the h-entry has a parent h-feed with author property, use that
  5. if an author property was found
    1. if it has an h-card, use it, exit.
    2. otherwise if author property is an http(s) URL, let the author-page have that URL
    3. otherwise use the author property as the author name, exit
  6. if there is no author-page and the h-entry's page is a permalink page, then
    1. if the page has a rel-author link, let the author-page's URL be the href of the rel-author link
  7. if there is an author-page URL
    1. get the author-page from that URL and parse it for microformats2
    2. if author-page has 1+ h-card with url == uid == author-page's URL, then use first such h-card, exit.
    3. else if author-page has 1+ h-card with 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 h-card, exit.
    4. if the h-entry's page has 1+ h-card with url == author-page URL, use first such h-card, exit.
  8. 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.

Questions

  • In step 7, "if author-page has 1+ h-card...", can you clarify the meaning of "has"? In my implementation, I was checking for the presence of this h-card by iterating through all top-level "items" on the page and checking those. However, I believe I found an example where this fails. When the home page h-card is actually the "author" property of the top-level h-feed, my consuming code doesn't find this h-card. Is this sentence intended to match this case? If so, clarification on what it means to say a page "has" an h-card would be helpful. Parsing the HTML for h-card will easily find this h-card, but once you're working with the mf2 parsed result, it is buried a little deeper in the data structure. Aaron Parecki 06:45, 24 February 2017 (PST)
    • "has" like CSS .h-card - Tantek Çelik 13:02, 26 July 2017 (PDT)
    • so, if you're working with the JSON structure, this means you have to iterate through every mf2 object and all levels of nesting to look for an h-card then? Aaron Parecki 08:43, 21 November 2017 (PST)
  • sknebel 2017-05-13: "if there is no author-page and the h-entry's page is a permalink page": What makes a page a permalink page? url == u-url? only one root h-entry on the page (and no feed)?
    • url of page == h-entry's u-url seems like a good start at that. Tantek Çelik 13:02, 26 July 2017 (PDT)
  • Martijn van der Ven 2017-07-16: could this same authorship algorithm be applied to h-feed? See chat. Are there any obvious problems with this?
    • It would start at step 4.
    • Step 5 is done as normal.
    • Step 6 would need “the h-entry’s page” changed to “the h-feed’s page”.
    • Same for step 7.4.
    • (end algorithm summary)
    • Seems like a good idea, what are the consuming code use-cases for this? Tantek Çelik 13:02, 26 July 2017 (PDT)

Test cases

Issues

Spoofing

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 present at:

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.

Does not implement standards

The algorithm described above does only rely on new markup, but does not consider the page's head meta and link tags with rel="author". They have been used since HTML 3.02 and are still defined in HTML5:

  • http://www.w3.org/TR/REC-html32#meta
    • meta tags long abandoned in practice (with few exceptions, not author). Lacking any real world indieweb examples that depend/need this, makes no sense to burden consuming code with unreliable legacy hidden metadata. Better to encourage the less-bad rel=author link to a page with visible author information marked up with h-card. - Tantek Çelik 12:56, 26 July 2017 (PDT)
  • http://www.w3.org/TR/html5/links.html#linkTypes
    • rel=author was already in algorithm at step 6.1 when issue noted. - Tantek Çelik 12:56, 26 July 2017 (PDT)

multiple authors

A lot of steps could be expanded (have discovery steps check for a list of authors, do "enrichment" steps for each of them individually) for dealing with multiple authors. Do we have examples of posts published with multiple authors?

Other theoretical

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?
    • Algorithm updated for handling a string-only author that is a URL. See 5.2.
    • 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)
    • Aaron Parecki's new site is now an example in the wild, e.g. https://aaronparecki.com/2016/04/06/15/ Kylewm.com 14:04, 7 April 2016 (PDT)
  • Step 7.4 looks for h-cards on the current page and will use the first one where the url property matches the author URL. The current page could have many such h-cards when minimal person cards are used for linking to other people (e.g. for person-tags), and these h-cards may have been created by someone other than the currently sought after author. They could use a nickname for the person rather than the actual name they would have expected.
    • This is an acceptable problem when 7.1–7.3 have all failed, as the algo has tried to get a full name from the author’s own specified page. It was discussed moving 7.4 to before 7.1–7.3 which may highlight the trade-of.
      • Checking whether the author page is on a different domain could help against this. E.g. by not accepting an h-card on the current page if the current page is on a different domain from the author URL.
      • Another option is to use 7.4 as a value until you get around to parsing the external page as outlined by 7.1–7.3. Then the value will be updated for its actually specified value but the overhead of the web request can be offloaded.
    • Applying the algo to h-entry objects for comments could potentially make for a bigger chance that a minimal person card has been used previously in source order. E.g. someone commenting on a post they were person tagged in.
    • Looking through the current document for h-cards in other places can help out when the document’s mark-up does not allow the h-card to be nested directly under the h-entry, because of layout/DOM limitations. See a discussion on the #microformats IRC channel. (This time brought on by Keith J. Grant.)
      • Keith also wishes “there was a way to say the mf of element X is associated with the h-* defined by element Y.” [1] This is basically what is being done by having the u-author property map to any h-card on the page with a matching u-url. In the mapping use-case it makes sense to do so before retrieving external resources.

Use Cases

Name avatar display in comments

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.

Name avatar display in a reader

In a reader (feature of an IndieWeb site), it's nice to show the name and icon/avatar of the person whose posts you're reading from their indieweb home page h-feed.

Typically this name/icon information is found via the authorship algorithm.

Unhandled Examples

In some (many?) cases, an indieweb h-feed of h-entry elements does not have explicit author information for a couple of reasons:

  • No author information inside each h-entry, because it would be redundant, since all the entries (the entire h-feed) are from the same author.
  • No rel=author link, because the page itself is likely the home page and thus page representing the author.

IndieWeb examples:

  • Tantek Çelik's home page at http://tantek.com/
    • tried <a class="u-author" href="/"></a> inside h-entry but there doesn't seem to be much interest in handling that. Also am leaning against having to include such seemingly empty / non-visible markup just to work around algorithm limitations.
  • ...

Fallback to page representative h-card

Proposal: we could add one more fallback to lack of author h-card, or lack of rel-author, and that is to use the page being processed as the author-page if no other author page has yet been found.

I.e. change "7. if there is an author-page URL " to "7. if there is no author-page URL, use the page itself as the author-page URL" and then continue processing the rest of the algorithm accordingly.

This would handle the examples from above:


Fallback to icon for photo

Proposal: if the author doesn't have a photo in their entry h-card, and they also don't have a photo on their representative h-card, but you still want to display a photo as an avatar, how about looking for an icon in the head of the document?

If a rel="icon" value exists that is using type="image/jpg" (or maybe type="image/png", but *not* type="image/ico"), then that image could be used an avatar. If a sizes attribute exists, a parser can look for the most appropriate size for display as an avatar.

This could be used as a last resort if every other photo discovery mechanism fails to return an image.

(idea by Loic)

Examples of sites with icons, but without photos in h-cards:

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.

Implementations

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

Converspace

XRay

ProcessWire Webmention

  • The ProcessWire Webmention plugin handles the authorship algorithm as of 2016-04-10 with the exception of step 4
    • gRegor Morrill runs this on gregorlove.com. I'm skipping step 4 for now because it's undecided what the desired behavior would be if an h-feed page sent a webmention.

Dobrado

SimplePie

mf-obj

Silo Implementations

none currently

Past Implementations

Google Search

Support dropped 2014-08-28[2]

Google's search spider supported 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

googleplus-authorship.png

See Also

Personal tools
Namespaces
Variants
Actions
Recent & Upcoming
Resources
Toolbox