add microformats/etc to the page data we send for share and marks

RESOLVED FIXED in Firefox 33

Status

()

Firefox
SocialAPI
RESOLVED FIXED
5 years ago
4 years ago

People

(Reporter: mixedpuppy, Assigned: mixedpuppy)

Tracking

26 Branch
Firefox 33
x86
Mac OS X
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

5 years ago
Created attachment 816571 [details] [diff] [review]
microformats for share

We have a couple potential providers that need more than just OpenGraph data for their use cases.  There was also the recent kerfufle with an addon [left unnamed] which injected remote javascript into pages.  I used them as a use case and examined what it is that they need an addon for.  The primary issue is getting expanded data about the page from opengraph, microformats, oEmbed, and schema.org markup to provide good UI to the user for selecting what to share.

OpenGraph - currently partially supported - provides page level meta data.  We only pass some OpenGraph tags

Meta and Link tags - currently partially supported - providing page level meta data.  We do not pass all meta tags at this time, so it is not possible for a provider to support oEmbed.

Microformats - currently not supported - content level descriptions.  Some services use this for expanded data on recipes, articles, products, etc.  Since it is a content level markup, a page can contain more than one, very useful and something I've been thinking about for some time.  We have a microformats parser in toolkit already, though it only supports a couple formats, not all the formats we need.  Also examine Microformats2 support (can we do both?)

oEmbed - currently not supported - defines an HTTP endpoint that you can access for enhanced page meta data.  The page contains a link tag pointing to the oembed endpoint.

Schema.org - currently not supported - defines content level descriptions similar to microformats.

For share and social marks we send a DOM event after page load that contains some OpenGraph and Meta tag information.  This is to support the ability for the page to offer enhanced share UI without having to round trip to the page on the backend.

Suggested approach:

- pass all open graph and meta tags that have name/values.
- pass all link tags with rel=alternative (for oEmbed support)
- use the existing Microformats.jsm to parse microformats when using the context menu to share specific items.  We need to add some new parsers for hListing, hNews, hMedia, hRecipe and hProduct.
- punt on Schema.org support in the short term but see if we can find or write a reasonable Schema.org parser.

I have a WIP patch.  example data added to the dom event:

{
  "url": "http://tantek.com/",
  "microformats": [{
    "fn": "Tantek �elik",
    "n": {
      "given-name": ["Tantek"],
      "family-name": ["�elik"]
    },
    "org": [{
      "organization-name": "Technorati"
    }],
    "url": ["http://tantek.com/"],
    "node": {
      "microformat": "hCard"
    },
    "resolvedNode": {
      "microformat": "hCard"
    },
    "semanticType": "hCard"
  }]
}
Attachment #816571 - Flags: feedback?(mhammond)

Comment 1

5 years ago
+1 : this is a enabler for Talkilla click-to-call use cases.
Comment on attachment 816571 [details] [diff] [review]
microformats for share

Review of attachment 816571 [details] [diff] [review]:
-----------------------------------------------------------------

Seems fine to me at a quick glance.  Needs some tests (although Microformats.jsm already has good test coverage, so I guess we only need to test our interfaces with it)
Attachment #816571 - Flags: feedback?(mhammond) → feedback+
(Assignee)

Updated

5 years ago
Blocks: 926913
(Assignee)

Updated

5 years ago
Blocks: 926914
(Assignee)

Comment 3

5 years ago
Created attachment 817161 [details] [diff] [review]
microformats for share and marks
Assignee: nobody → mixedpuppy
Attachment #816571 - Attachment is obsolete: true
Attachment #817161 - Flags: review?(mhammond)

Comment 4

5 years ago
Reviewed the updated attachment, and from what I can understand the hCard support looks good.

In addition to the hCard support, this also looks like a good opportunity to incrementally add support for h-card - the microformats2 version.

When we share this information across APIs, the microformats2 representation is preferred (it has canonical JSON properties/structure)
* http://microformats.org/wiki/h-card

There was a question about about microformats2 parsing/parsers - there's excellent JS and PHP parsers in case that helps:
* http://microformats.org/wiki/parsers#microformats2_parsers

Parsing spec here:
* http://microformats.org/wiki/microformats2-parsing
Comment on attachment 817161 [details] [diff] [review]
microformats for share and marks

Review of attachment 817161 [details] [diff] [review]:
-----------------------------------------------------------------

Sorry for the delay - looks fine to me.

::: browser/base/content/nsContextMenu.js
@@ +1595,3 @@
>    },
>    shareLink: function CM_shareLink() {
> +    SocialShare.sharePage(null, { url: this.linkURI.spec }, this.target);

how is it that this.linkURI might be null in markLink but not in shareLink?
Attachment #817161 - Flags: review?(mhammond) → review+
(Assignee)

Comment 6

4 years ago
Created attachment 8453875 [details] [diff] [review]
microdata support

microformats v1 is not used by many of the target sites we're looking at whereas microdata/schema.org is.  This patch switches to using microdata which is already supported in firefox (other than the JSON serialization which is added to this patch, tests are in /dom/imptests/html/microdata).  We'll need a new bug to add microformats v2 support to firefox then we can support that as well.

The patch is largely unchanged from the previously reviewed patch but requesting a backup review due to the time laps since the last review.
Attachment #817161 - Attachment is obsolete: true
Attachment #8453875 - Flags: review?(felipc)
Attachment #8453875 - Flags: review?(felipc) → review+
(Assignee)

Comment 9

4 years ago
moved microformats support to bug 1037483

Comment 10

4 years ago
r- on parsing anything schema related - no one has permission to parse schema besides Google per their TOS. They only give permission to publish schema, not parse it: http://schema.org/docs/terms.html

"... **solely** for the purpose of **including markup of structured data in a webpage**". I'll follow-up with Moz legal on this too.

**emphasis** mine.

Also have discussed with Boris, Brendan removing microdata support since no one else supports it and webdevs don't care about that API (increase surface etc.).
(Assignee)

Comment 11

4 years ago
(In reply to Tantek Çelik from comment #10)
> r- on parsing anything schema related - no one has permission to parse
> schema besides Google per their TOS. They only give permission to publish
> schema, not parse it: http://schema.org/docs/terms.html
> 
> "... **solely** for the purpose of **including markup of structured data in
> a webpage**". I'll follow-up with Moz legal on this too.

That sentence fully reads "In addition, if the Sponsors have patent claims that are necessarily infringed by including markup of structured data in a webpage, where the markup is based on and strictly complies with the Schema, they grant an option to receive a license under reasonable and non-discriminatory terms without royalty, solely for the purpose of including markup of structured data in a webpage, where the markup is based on and strictly complies with the Schema."

It seems it would depend on whether a particular schema is patent encumbered.  Yes, legal should look at it, lets get that conversation going.  

There is no parsing of any given schema in the patch, only json serialization of microdata.

> **emphasis** mine.
> 
> Also have discussed with Boris, Brendan removing microdata support since no
> one else supports it and webdevs don't care about that API (increase surface
> etc.).

Microdata does have pretty broad support on various ecommerce sites that I've tested against.
https://hg.mozilla.org/mozilla-central/rev/ed9ec8fed9a4
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 33
You need to log in before you can comment on or make changes to this bug.