Post Type Discovery specifies an algorithm for determining the type of a post (related issue: #9: Use AS2 specific language for post types) by what properties it has and potentially what value(s) they have, which helps avoid the need for explicit post types that are being abandoned by modern post creation UIs.

This specification was contributed to the W3C from the IndieWeb community and is one of several related specifications being produced by the Social Web Working Group. More history and evolution of Post Type Discovery can be found on the IndieWeb wiki.


Post type discovery is an explicit algorithm for inferring the type of a post from other properties of that post.

Inferring the type of a post helps provide a bridge between systems without explicit post types (e.g. [[h-entry]], [[jf2]], [[micropub]]) to systems with explicit post types (e.g. [[ActivityPub]], [[AS2]]). For more details on those specifications see references, and for how they relate, see the overview document [[social-web-protocols]]. Post type discovery can apply to any post data structure independent of serialization (e.g. HTML, JSON, etc.)

Use Cases

Both creation user interfaces, and post presentation designs are evolving to directly use the presence or absence of specific properties (and their values) directly, rather than depending on any kind of explicit "post type", thus why bother discovering a post type in the first place? This section documents the (few) use-case(s) that is/are known to date.

Synthesizing explicit type formats

There are existing formats that require explicit post types (e.g. ActivityStreams [[AS1]]), or are based on explicit post types, (e.g. ActivityStreams2 [[AS2]]), and code that consumes them expects explicit post types. Post type discovery enabling automatic synthesizing of such formats from posts that merely have a set of content related properties.


As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.

The key words "MAY", "MUST", "MUST NOT", "OPTIONAL", "RECOMMENDED", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", and "SHOULD NOT" are to be interpreted as described in [[!RFC2119]].

Response Type Algorithm

The Response Type Algorithm ("the response algorithm") is for specifically discovering the type of a response, in particular as a result of receiving a [[!Webmention]], by analyzing the "source" from the Webmention, called the "response" in the response algorithm. It is a proper subset of the general Post Type Algorithm (defined below).

Quoted property names in the response algorithm are defined in [[!h-entry]].

Post Type Algorithm

The Post Type Algorithm ("the algorithm") discovers the type of a post given a data structure representing a post with a flat set of properties (e.g. Activity Streams (1.0 or 2.0) JSON, or JSON output from [[microformats2-parsing]]), each with one or more values, by following these steps until reaching the first "it is a(n) ... post" statement at which point the "..." is the discovered post type.

Quoted property names in the algorithm are defined in [[!h-entry]].


There are two important aspects to the methodology of the Post Type Discovery algorithm: scope (why is something explicitly in the algorithm), and order (why is something where it is in the algorithm).


The algorithm could attempt to cover innumerable potential hypothetical post types, or take an evidence based approach, focusing on real world publishing practices. This specification does the latter, specifically by placing a minimum bar of documented real world publishing practices of different visually apparent post types on the open web at recent (< 1 year old) permalinks, each with at least three independent implementations that have converged on what properties (and potentially values thereof) they have to imply their visually apparent post types. As a result of being evidence based, it is likely this specification will expand over time as more apparent post types are published by more convergent implementations.


The algorithm must also specify an order (e.g. of precedence) that various properties (and their values) imply various post types. The algorithm is ordered by post types that are in general "richer" in terms of content as well as show greater cognitive effort by the author.

Other Types Under Consideration

Other types are being considered and will be included in the future iterations of the algorithm based on convergence of publishing patterns and critical mass of adoption thereof.


Like Post

Here is an example [[h-entry]] post from Activity Streams 2.0 Vocabulary examples [[AS2-vocab]]:

<div class="h-entry p-name">
  <span class="p-author h-card">Sally</span>
  <a class="u-like-of"

Following the algorithm, the step "If the post has a "like-of" property with a valid URL" is satisfied and thus the algorithm returns that the post is a "like" post.

Given this semantic, an implementation can generate (or process as if generated and consumed) the following AS2 JSON, in particular the "@type": "Like" in this output is what is determined by this algorithm:

  "@type": "Like",
  "actor": {
    "@type": "Person",
    "displayName": "Sally"
  "object": ""


What about a photo reply

Q: What about a reply that includes a photo?

A: It's a reply.

Q2: Should that show up as a "photo" post?

A2: It should show up as a "reply" and not be in a user's published feed of their photos. The user-centric design here is to treat replies separately, because in practice, when users post replies to others' posts, and include a photo, the photos typically assume the context of that other post, and would look odd outside of it (e.g. in a generic "photos" feed). In addition, by not including reply photos in a user's feed of their photos, it gives the user the freedom to reply to other posts with whatever they wish, including photos, and not have those reply-specific photos pollute their streams of "their stuff" that their followers subscribe to.

A2a: From a presentation perspective, a reply should primarily be displayed as a reply first, and then adapt accordingly to whatever other properties it may have.

Is a video tag sufficient

Q: Is a video tag sufficient to imply a video post?

A: No, video tags can be used for additional content e.g. inside an article. Only relying on video tag markup would lead to false positives.


Implementations, in progress, partial, or complete, of Post Type Discovery.


Granary synthesizes ActivityStreams [[AS1]], [[microformats2]], and Atom [[RFC4287]] from various input feeds and sources, and as such has some code that can be considered in progress or even a partial implementation of Post Type Discovery:


p3k (a CMS) implements Post Type Discovery internally within its [[micropub]] endpoint to automatically add posts to various collections. E.g.: if this post is a reply, it goes in the "replies" collection. if it's an RSVP, it goes in the "rsvps" and "replies" collections.


mf2util exposes a function for post_type_discovery that takes an h-entry and returns "like", "reply", "note", "article", etc.

Change Log

Changes from 14 June 2017 WD to this version

Changes from 1 March 2017 WD to 14 June 2017 WD

Changes from 28 October 2016 WD to 1 March 2017 WD