From 4f33af7cbb5eb99586ce60f4c4231c40904fb6e9 Mon Sep 17 00:00:00 2001 From: Kostas Date: Mon, 22 Jul 2019 13:53:19 +0100 Subject: [PATCH 1/2] Add support for LiveBlogPosting article types --- amp-story/linter/caches.json | 10 +++++++++- ampbench_lib.js | 18 ++++++++++++++++++ ampbench_lib_sd.js | 6 +++--- package-lock.json | 36 ++++++++++++++++++------------------ 4 files changed, 48 insertions(+), 22 deletions(-) diff --git a/amp-story/linter/caches.json b/amp-story/linter/caches.json index 642a52c..0c3edcd 100644 --- a/amp-story/linter/caches.json +++ b/amp-story/linter/caches.json @@ -12,9 +12,17 @@ "id": "cloudflare", "name": "Cloudflare AMP Cache", "docs": "https://amp.cloudflare.com/", - "cacheDomain": "cdn.cloudflare.com", + "cacheDomain": "amp.cloudflare.com", "updateCacheApiDomainSuffix": "amp.cloudflare.com", "thirdPartyFrameDomainSuffix": "cloudflareamp.net" + }, + { + "id": "bing", + "name": "Bing AMP Cache", + "docs": "https://www.bing.com/webmaster/help/bing-amp-cache-bc1c884c", + "cacheDomain": "bing-amp.com", + "updateCacheApiDomainSuffix": "bing-amp.com", + "thirdPartyFrameDomainSuffix": "bing-amp.net" } ] } diff --git a/ampbench_lib.js b/ampbench_lib.js index 4a97be2..415009b 100644 --- a/ampbench_lib.js +++ b/ampbench_lib.js @@ -388,6 +388,9 @@ class HttpBodySniffer { BlogPosting: this.bodyContains('"@type":"BlogPosting"') || this.jsonldScriptContains('"@type":"BlogPosting"'), + LiveBlogPosting: + this.bodyContains('"@type":"LiveBlogPosting"') || + this.jsonldScriptContains('"@type":"LiveBlogPosting"'), WebPage: this.bodyContains('"@type":"WebPage"') || this.jsonldScriptContains('"@type":"WebPage"'), @@ -417,6 +420,9 @@ class HttpBodySniffer { BlogPosting: this.bodyContains('itemtype="http://schema.org/BlogPosting"') || this.bodyContains('itemtype="https://schema.org/BlogPosting"'), + LiveBlogPosting: + this.bodyContains('itemtype="http://schema.org/LiveBlogPosting"') || + this.bodyContains('itemtype="https://schema.org/LiveBlogPosting"'), WebPage: this.bodyContains('itemtype="http://schema.org/WebPage"') || this.bodyContains('itemtype="https://schema.org/WebPage"'), @@ -436,6 +442,7 @@ class HttpBodySniffer { this._contains_sd.jsonld_type.Article || this._contains_sd.jsonld_type.NewsArticle || this._contains_sd.jsonld_type.BlogPosting || + this._contains_sd.jsonld_type.LiveBlogPosting || this._contains_sd.jsonld_type.VideoObject; this._jsonld_type_is_amp_news_carousel_support = @@ -451,6 +458,7 @@ class HttpBodySniffer { this._contains_sd.microdata_type.Article || this._contains_sd.microdata_type.NewsArticle || this._contains_sd.microdata_type.BlogPosting || + this._contains_sd.microdata_type.LiveBlogPosting || this._contains_sd.microdata_type.VideoObject; this._microdata_type_is_amp_news_carousel_support = @@ -498,6 +506,11 @@ class HttpBodySniffer { + ( this._contains_sd.microdata_type.BlogPosting ? ' BlogPosting (Microdata)' : '' ) + + ( this._contains_sd.jsonld_type.LiveBlogPosting + ? ' LiveBlogPosting (JSON-LD)' : '' ) + + ( this._contains_sd.microdata_type.LiveBlogPosting + ? ' LiveBlogPosting (Microdata)' : '' ) + + ( this._contains_sd.jsonld_type.WebPage ? ' WebPage (JSON-LD)' : '' ) + ( this._contains_sd.microdata_type.WebPage @@ -534,6 +547,11 @@ class HttpBodySniffer { + ( this._contains_sd.microdata_type.BlogPosting ? ' BlogPosting (Microdata)' : '' ) + + ( this._contains_sd.jsonld_type.LiveBlogPosting + ? ' BlogPosting (JSON-LD)' : '' ) + + ( this._contains_sd.microdata_type.LiveBlogPosting + ? ' BlogPosting (Microdata)' : '' ) + + ( this._contains_sd.jsonld_type.VideoObject ? ' VideoObject (JSON-LD)' : '' ) + ( this._contains_sd.microdata_type.VideoObject diff --git a/ampbench_lib_sd.js b/ampbench_lib_sd.js index f6488f1..26445fc 100644 --- a/ampbench_lib_sd.js +++ b/ampbench_lib_sd.js @@ -44,8 +44,8 @@ const SD_UNKNOWN = 'Unknown, Invalid or Unavailable'; const - AMP_SD_TYPES = ['Article', 'NewsArticle', 'BlogPosting', 'VideoObject'], - AMP_SD_TYPES_ARTICLE = ['Article', 'NewsArticle', 'BlogPosting'], + AMP_SD_TYPES = ['Article', 'NewsArticle', 'BlogPosting', 'VideoObject', 'LiveBlogPosting'], + AMP_SD_TYPES_ARTICLE = ['Article', 'NewsArticle', 'BlogPosting', 'LiveBlogPosting'], AMP_SD_TYPES_ARTICLE_COMPANIONS = ['WebPage', 'Organization', 'ImageObject'], // TODO AMP_SD_TYPES_RECIPE = ['Recipe'], AMP_SD_TYPES_WEBPAGE = ['WebPage']; @@ -890,7 +890,7 @@ function extract_metadata_microdata_news_types(metadata) { // scan for all news _md_news_found = false; // init to negative! metadata.json.forEach( (md_block, _md_block_index) => { _md_type = last_element_of_path((md_block['@type'][0]).toString()); - if (sd_type_is_amp_article(_md_type)) { // AMP_SD_TYPES_ARTICLE = ['Article', 'NewsArticle', 'BlogPosting'] + if (sd_type_is_amp_article(_md_type)) { // AMP_SD_TYPES_ARTICLE = ['Article', 'NewsArticle', 'BlogPosting', 'LiveBlogPosting] // console.log('=> _md_type: ' + _md_type); _md_news_found = true; _md_types.push(_md_type); diff --git a/package-lock.json b/package-lock.json index b1b944e..3b5c672 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,12 +44,12 @@ }, "acorn": { "version": "2.7.0", - "resolved": "http://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz", "integrity": "sha1-q259nYhqrKiwhbwzEreaGYQz8Oc=" }, "acorn-globals": { "version": "1.0.9", - "resolved": "http://registry.npmjs.org/acorn-globals/-/acorn-globals-1.0.9.tgz", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-1.0.9.tgz", "integrity": "sha1-VbtemGkVB7dFedBRNBMhfDgMVM8=", "optional": true, "requires": { @@ -108,7 +108,7 @@ "dependencies": { "promise": { "version": "7.1.1", - "resolved": "http://registry.npmjs.org/promise/-/promise-7.1.1.tgz", + "resolved": "https://registry.npmjs.org/promise/-/promise-7.1.1.tgz", "integrity": "sha1-SJZUxpJha4qlWwck+oCbt9tJxb8=", "requires": { "asap": "~2.0.3" @@ -592,7 +592,7 @@ }, "commander": { "version": "2.9.0", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", "requires": { "graceful-readlink": ">= 1.0.0" @@ -2081,7 +2081,7 @@ }, "get-stream": { "version": "3.0.0", - "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" }, "get-value": { @@ -2157,7 +2157,7 @@ }, "got": { "version": "6.7.1", - "resolved": "http://registry.npmjs.org/got/-/got-6.7.1.tgz", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", "requires": { "create-error-class": "^3.0.0", @@ -2504,7 +2504,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=" }, "is-path-cwd": { @@ -2630,7 +2630,7 @@ }, "jsdom": { "version": "7.2.2", - "resolved": "http://registry.npmjs.org/jsdom/-/jsdom-7.2.2.tgz", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-7.2.2.tgz", "integrity": "sha1-QLQCdwwr2iNGkJa+6Rq2deOx/G4=", "optional": true, "requires": { @@ -2861,7 +2861,7 @@ }, "minimist": { "version": "0.0.8", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "mixin-deep": { @@ -2885,7 +2885,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" @@ -3334,14 +3334,14 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" } } }, "readable-stream": { "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "requires": { "core-util-is": "~1.0.0", @@ -3367,7 +3367,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "requires": { "core-util-is": "~1.0.0", @@ -3552,7 +3552,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "requires": { "ret": "~0.1.10" @@ -3907,7 +3907,7 @@ }, "strip-eof": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" }, "strip-json-comments": { @@ -3980,7 +3980,7 @@ }, "through": { "version": "2.3.8", - "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "timed-out": { @@ -4071,7 +4071,7 @@ }, "tunnel": { "version": "0.0.2", - "resolved": "http://registry.npmjs.org/tunnel/-/tunnel-0.0.2.tgz", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.2.tgz", "integrity": "sha1-8jvNi3p7ioZCYbIIT2b5MZM5YzQ=" }, "tunnel-agent": { @@ -4336,7 +4336,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" } } From 06336c12589669059f4b6ce9babd50c782500a14 Mon Sep 17 00:00:00 2001 From: Kostas Date: Wed, 2 Oct 2019 16:08:04 +0100 Subject: [PATCH 2/2] Update lock file --- package-lock.json | 49 ++++++++++++++--------------------------------- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/package-lock.json b/package-lock.json index f7ec559..3b5c672 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,9 +44,8 @@ }, "acorn": { "version": "2.7.0", - "resolved": "http://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz", - "integrity": "sha1-q259nYhqrKiwhbwzEreaGYQz8Oc=", - "optional": true + "resolved": "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz", + "integrity": "sha1-q259nYhqrKiwhbwzEreaGYQz8Oc=" }, "acorn-globals": { "version": "1.0.9", @@ -707,8 +706,7 @@ "cssom": { "version": "0.3.4", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.4.tgz", - "integrity": "sha512-+7prCSORpXNeR4/fUP3rL+TzqtiFfhMvTd7uEqMdgPvLPt4+uzFUeufx5RHjGTACCargg/DiEt/moMQmvnfkog==", - "optional": true + "integrity": "sha512-+7prCSORpXNeR4/fUP3rL+TzqtiFfhMvTd7uEqMdgPvLPt4+uzFUeufx5RHjGTACCargg/DiEt/moMQmvnfkog==" }, "cssstyle": { "version": "0.2.37", @@ -1631,8 +1629,7 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true, - "optional": true + "bundled": true }, "aproba": { "version": "1.2.0", @@ -1650,13 +1647,11 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1669,18 +1664,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -1783,8 +1775,7 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -1794,7 +1785,6 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -1807,20 +1797,17 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true, - "optional": true + "bundled": true }, "minipass": { "version": "2.2.4", "bundled": true, - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -1837,7 +1824,6 @@ "mkdirp": { "version": "0.5.1", "bundled": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -1910,8 +1896,7 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -1921,7 +1906,6 @@ "once": { "version": "1.4.0", "bundled": true, - "optional": true, "requires": { "wrappy": "1" } @@ -1997,8 +1981,7 @@ }, "safe-buffer": { "version": "5.1.1", - "bundled": true, - "optional": true + "bundled": true }, "safer-buffer": { "version": "2.1.2", @@ -2028,7 +2011,6 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -2046,7 +2028,6 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -2085,13 +2066,11 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, - "optional": true + "bundled": true }, "yallist": { "version": "3.0.2", - "bundled": true, - "optional": true + "bundled": true } } },