Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tantek opened this issue Aug 6, 2020 · 6 comments

Comments

@tantek
Copy link
Member

tantek commented Aug 6, 2020

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/)

@Zegnat
Copy link
Member

Zegnat commented Aug 7, 2020

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
Copy link
Member

aaronpk commented Sep 12, 2020

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
Copy link
Member

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.

  • We would need a validator to validate mf2 json(See https://microformats.org/wiki/microformats2-json#See_Also)
  • Update all sites that emit microformats 2 json to use the new mime-type once validator is available to test, specifically microformats.io mf2json output.
  • Need to specify an mf2-json content-type (wire protocol) spec to discuss how to publish and consume it, e.g. over HTTP. Also: rel-alternate usage, http headers, etc.
  • Need to specify a mf2-json content spec, which has the various constraints about must ignore or must reject, additional keys etc.
  • Example of description of the mf2 JSON objects: https://microformats.org/wiki/microformats2-json (does not include information about ignoring properties).
@jamietanna
Copy link

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

@jalcine
Copy link

jalcine commented Nov 15, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment