microformats / microformats2-parsing

For collecting and handling issues with the microformats2 parsing specification: http://microformats.org/wiki/microformats2-parsing
14 stars 6 forks source link

Should we specify a MIME type / Content-Type for canonical JSON from parsed mf2? #52

Open tantek opened 4 years ago

tantek commented 4 years ago

There has been some past brainstorming about possible MIME types for the JSON resulting from a compliant microformats2 parsing implementation: microformats2-mime-type. It seems one in particular, application/mf2+json, has seen some adoption in the wild: https://indieweb.org/application/mf2+json. Should we specify an explicit MIME type for the parsed JSON result of an mf2 parser? And if so, should we adopt application/mf2+json or some other alternative?

Labels: enhancement, question, needs proposed resolution.

(Originally published at: https://tantek.com/2020/219/b1/)

snarfed commented 4 years ago

granary emits (but doesn't consume) this MIME type: https://github.com/snarfed/granary/blob/master/api.py#L77-L79 https://github.com/snarfed/granary/blob/master/api.py#L218

Zegnat commented 4 years ago

XRay consumes it, but really rather than consuming it may be better described as discovery based on mime type. If a page has a rel-alternate with the type attribute set to application/mf2+json it will grab and read that. Ie. instead of rel="alternate" type="application/rss+xml" for RSS we can use rel="alternate" type="application/mf2+json" for pre-parsed mf2.

If I recall correctly this is something that came as a proposal from the WordPress plugin developers. As it gives WordPress a way to provide clean mf2 to consuming applications without depending on theme support.

Do we have any other usage in mind for a MIME type? If the use is limited as sort of a flag on links, is it worth going through a registration process?

aaronpk commented 3 years ago

Specifically XRay will look for that rel alternate value and if it finds one, it will use that JSON and ignore all microformats in the HTML, the assumption being that the JSON will be higher quality because of the wordpress problem.

dshanske commented 3 years ago

The next steps discussed at the Microformats session online today was that the idea was sound to assist sites that, for whatever reason, could not mark up html with proper microformats(WordPress being a common example).

Steps to proceed would be.

jamietanna commented 2 years ago

I've been returning application/mf2+json for the parsed MF2 JSON on meetup-mf2, eventbrite-mf2 and books-mf2.

jalcine commented 1 year ago

When one interacts with Shock asking for

application/mf2+json
on posts, it returns the page as Microformats JSON. I found this useful for quick testing but also plan to add it to Lighthouse to get a site's preferred Microformats JSON if they've provided parsing to save doing so on my side. One can run curl -H 'Accept: application/mf2+json' https://jacky.wtf/2022/11/GxDN and get the following output:

    {"items":[{"post-type":[["note"]],"properties":{"channel":["all"],"content":[{"html":"

    As expected. [https://restofworld.org/2022/twitter-will-fail-under-musk/](https://jacky.wtf/2022/11/\\"https:/restofworld.org/2022/twitter-will-fail-under-musk/\\")

    ","value":"As expected. https://restofworld.org/2022/twitter-will-fail-under-musk/"}],"generator":[{"properties":{"logo":[{"alt":"Quill","src":"https://quill.p3k.io/images/quill-logo-144.png"}],"name":["Quill"],"photo":[{"alt":"Quill","src":"https://quill.p3k.io/images/quill-logo-144.png"}],"url":["https://quill.p3k.io/"]},"type":["h-app","h-x-app","h-cite"],"value":"https://quill.p3k.io/"}],"post-status":["published"],"published":["2022-11-15T01:23:33Z"],"syndication":[{"id":"syrt_3177","properties":{"status":["completed"],"syndicator":[{"properties":{"name":["Twitter"],"uid":["urn:koype:syndicator:sytg_d3ee3c5112765be7"],"url":["https://brid.gy/publish/twitter"]},"type":["h-syndicator","h-card"],"value":"https://brid.gy/publish/twitter"}],"url":["https://twitter.com/jackyalcine/status/1592327479196262401"]},"type":["h-cite"],"value":"https://twitter.com/jackyalcine/status/1592327479196262401"},{"id":"syrt_3178","properties":{"status":["completed"],"syndicator":[{"properties":{"name":["@jalcine@todon.eu"],"uid":["urn:koype:syndicator:sytg_dDXu"],"url":["https://brid.gy/publish/mastodon"]},"type":["h-syndicator","h-card"],"value":"https://brid.gy/publish/mastodon"}],"url":["https://todon.eu/@jalcine/109345205873077689"]},"type":["h-cite"],"value":"https://todon.eu/@jalcine/109345205873077689"}],"url":["https://jacky.wtf/2022/11/GxDN"],"visibility":["public"]},"type":["h-entry"]}],"rel-urls":{},"rels":{}}

(Originally published at: https://jacky.wtf/2022/11/m6Bz)