@adobe/helix-html-pipeline 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ # [1.5.0](https://github.com/adobe/helix-html-pipeline/compare/v1.4.2...v1.5.0) (2022-05-04)
2
+
3
+
4
+ ### Features
5
+
6
+ * always add twitter:card ([4b14e31](https://github.com/adobe/helix-html-pipeline/commit/4b14e3144625d9b457079ae7fc654621e3271e14)), closes [#46](https://github.com/adobe/helix-html-pipeline/issues/46)
7
+
8
+ ## [1.4.2](https://github.com/adobe/helix-html-pipeline/compare/v1.4.1...v1.4.2) (2022-05-03)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update dependency @adobe/helix-shared-utils to v2.0.9 ([2aee8a3](https://github.com/adobe/helix-html-pipeline/commit/2aee8a3c70388a220bacdef1671e6c899b02736f))
14
+
15
+ ## [1.4.1](https://github.com/adobe/helix-html-pipeline/compare/v1.4.0...v1.4.1) (2022-04-16)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **deps:** update dependency @adobe/helix-shared-utils to v2.0.8 ([9c7e30d](https://github.com/adobe/helix-html-pipeline/commit/9c7e30daccfab99e0dc5861f7105c0eee6c88ca5))
21
+
1
22
  # [1.4.0](https://github.com/adobe/helix-html-pipeline/compare/v1.3.4...v1.4.0) (2022-04-12)
2
23
 
3
24
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Helix HTML Pipeline
2
2
 
3
- This package contains the common code for `helix-pipeline-service` and `helix-cloudflare-pipeline` for rendering the html response for helix3. it has the following design goals:
3
+ This package contains the common code for `helix-pipeline-service` and `helix-cloudflare-page` for rendering the html response for helix3. it has the following design goals:
4
4
 
5
5
  - be platform neutral, i.e. not using node or browser specific modules or dependencies.
6
6
  - +/-0 runtime dependencies (eg. node [crypto](https://nodejs.org/api/crypto.html))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@adobe/helix-markdown-support": "3.1.2",
36
- "@adobe/helix-shared-utils": "2.0.7",
36
+ "@adobe/helix-shared-utils": "2.0.9",
37
37
  "github-slugger": "1.4.0",
38
38
  "hast-util-raw": "7.2.1",
39
39
  "hast-util-select": "5.0.1",
@@ -67,16 +67,16 @@
67
67
  },
68
68
  "devDependencies": {
69
69
  "@adobe/eslint-config-helix": "1.3.2",
70
- "@markedjs/html-differ": "4.0.1",
70
+ "@markedjs/html-differ": "4.0.2",
71
71
  "@semantic-release/changelog": "6.0.1",
72
72
  "@semantic-release/git": "10.0.1",
73
73
  "@semantic-release/npm": "9.0.1",
74
- "c8": "7.11.0",
74
+ "c8": "7.11.2",
75
75
  "chalk-template": "0.4.0",
76
76
  "codecov": "3.8.3",
77
77
  "commitizen": "4.2.4",
78
78
  "cz-conventional-changelog": "3.3.0",
79
- "eslint": "8.13.0",
79
+ "eslint": "8.14.0",
80
80
  "eslint-plugin-header": "3.1.1",
81
81
  "eslint-plugin-import": "2.26.0",
82
82
  "esmock": "1.7.5",
@@ -85,8 +85,8 @@
85
85
  "jsdoc-to-markdown": "7.1.1",
86
86
  "jsdom": "19.0.0",
87
87
  "junit-report-builder": "3.0.0",
88
- "lint-staged": "12.3.7",
89
- "mocha": "9.2.2",
88
+ "lint-staged": "12.4.1",
89
+ "mocha": "10.0.0",
90
90
  "mocha-multi-reporters": "1.5.1",
91
91
  "remark-gfm": "3.0.1",
92
92
  "semantic-release": "19.0.2"
@@ -161,6 +161,8 @@ export default function extractMetaData(state, req) {
161
161
  getLocalMetadata(hast),
162
162
  );
163
163
 
164
+ const IGNORED_CUSTOM_META = [...ALLOWED_RESPONSE_HEADERS, 'twitter:card'];
165
+
164
166
  // first process supported metadata properties
165
167
  [
166
168
  'title',
@@ -180,7 +182,7 @@ export default function extractMetaData(state, req) {
180
182
  if (Object.keys(metaConfig).length > 0) {
181
183
  // add rest to meta.custom
182
184
  meta.custom = Object.entries(metaConfig)
183
- .filter(([name]) => !ALLOWED_RESPONSE_HEADERS.includes(name))
185
+ .filter(([name]) => !IGNORED_CUSTOM_META.includes(name))
184
186
  .map(([name, value]) => ({
185
187
  name,
186
188
  value,
@@ -188,6 +190,9 @@ export default function extractMetaData(state, req) {
188
190
  }));
189
191
  }
190
192
 
193
+ // default value for twitter:card (mandatory for rendering URLs as cards in tweets)
194
+ meta['twitter:card'] = metaConfig['twitter:card'] || 'summary_large_image';
195
+
191
196
  if (meta.keywords) {
192
197
  meta.keywords = toList(meta.keywords).join(', ');
193
198
  }
@@ -71,6 +71,7 @@ export default async function render(state, req, res) {
71
71
  appendElement($head, createElement('meta', 'property', 'article:section', 'content', content.meta.section));
72
72
  appendElement($head, createElement('meta', 'property', 'article:published_time', 'content', content.meta.published_time));
73
73
  appendElement($head, createElement('meta', 'property', 'article:modified_time', 'content', content.meta.modified_time));
74
+ appendElement($head, createElement('meta', 'name', 'twitter:card', 'content', content.meta['twitter:card']));
74
75
  appendElement($head, createElement('meta', 'name', 'twitter:title', 'content', content.meta.title));
75
76
  appendElement($head, createElement('meta', 'name', 'twitter:description', 'content', content.meta.description));
76
77
  appendElement($head, createElement('meta', 'name', 'twitter:image', 'content', content.meta.image));