mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 06:45:42 +00:00
Bug 1311434
- Website Metadata: Get provider name from Open Graph tags. r=Grisha
There's a pull request [1] and issue [2] on GitHub tracking the work to land this in the page-metadata-parser repository. Multiple potential sources for getting a 'provider name' are considered in the linked issue - however they all have slightly different semantic meanings. Only 'og:site_name' actually has the same meaning as "provider name". Therefore it is pretty safe to land this part. [1] https://github.com/mozilla/page-metadata-parser/pull/81 [2] https://github.com/mozilla/page-metadata-parser/issues/79 MozReview-Commit-ID: KQFSLo85JoS --HG-- extra : rebase_source : ba86e5c3785cda500a1e8f5a8887228c72f6d00f
This commit is contained in:
parent
6fd5e31454
commit
bbe7ce58a6
@ -21,7 +21,8 @@ var WebsiteMetadata = {
|
||||
parseAsynchronously: function(doc) {
|
||||
Task.spawn(function() {
|
||||
let metadata = getMetadata(doc, doc.location.href, {
|
||||
image_url: metadataRules['image_url']
|
||||
image_url: metadataRules['image_url'],
|
||||
provider: metadataRules['provider']
|
||||
});
|
||||
|
||||
// No metadata was extracted, so don't bother sending it.
|
||||
@ -157,6 +158,12 @@ const metadataRules = {
|
||||
['link[rel="canonical"]', node => node.element.getAttribute('href')],
|
||||
],
|
||||
},
|
||||
|
||||
provider: {
|
||||
rules: [
|
||||
['meta[property="og:site_name"]', node => node.element.getAttribute('content')]
|
||||
]
|
||||
},
|
||||
};
|
||||
|
||||
function getMetadata(doc, url, rules) {
|
||||
|
Loading…
Reference in New Issue
Block a user