@adobe/helix-html-pipeline 1.4.2 → 1.5.2
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 +21 -0
- package/package.json +4 -3
- package/src/forms-pipe.js +2 -0
- package/src/json-pipe.js +2 -2
- package/src/steps/extract-metadata.js +6 -1
- package/src/steps/fetch-metadata.js +2 -2
- package/src/steps/render.js +1 -0
- package/src/utils/last-modified.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [1.5.2](https://github.com/adobe/helix-html-pipeline/compare/v1.5.1...v1.5.2) (2022-05-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* respect x-source-last-modified for json ([#51](https://github.com/adobe/helix-html-pipeline/issues/51)) ([094f22b](https://github.com/adobe/helix-html-pipeline/commit/094f22b4bc86306a3727472bdb1f03c65fe67012))
|
|
7
|
+
|
|
8
|
+
## [1.5.1](https://github.com/adobe/helix-html-pipeline/compare/v1.5.0...v1.5.1) (2022-05-06)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* include owner and repo to forms message ([#48](https://github.com/adobe/helix-html-pipeline/issues/48)) ([aabb52f](https://github.com/adobe/helix-html-pipeline/commit/aabb52f96fbdba74d73c4e6e24c3ad710a18442d))
|
|
14
|
+
|
|
15
|
+
# [1.5.0](https://github.com/adobe/helix-html-pipeline/compare/v1.4.2...v1.5.0) (2022-05-04)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* 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)
|
|
21
|
+
|
|
1
22
|
## [1.4.2](https://github.com/adobe/helix-html-pipeline/compare/v1.4.1...v1.4.2) (2022-05-03)
|
|
2
23
|
|
|
3
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-html-pipeline",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Helix HTML Pipeline",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"remark-parse": "10.0.1",
|
|
60
60
|
"strip-markdown": "5.0.0",
|
|
61
61
|
"unified": "10.1.2",
|
|
62
|
-
"unist-util-map": "3.
|
|
62
|
+
"unist-util-map": "3.1.1",
|
|
63
63
|
"unist-util-remove": "3.1.0",
|
|
64
64
|
"unist-util-remove-position": "4.0.1",
|
|
65
65
|
"unist-util-select": "4.0.1",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@adobe/eslint-config-helix": "1.3.2",
|
|
70
|
+
"@adobe/semantic-release-coralogix": "1.1.1",
|
|
70
71
|
"@markedjs/html-differ": "4.0.2",
|
|
71
72
|
"@semantic-release/changelog": "6.0.1",
|
|
72
73
|
"@semantic-release/git": "10.0.1",
|
|
@@ -76,7 +77,7 @@
|
|
|
76
77
|
"codecov": "3.8.3",
|
|
77
78
|
"commitizen": "4.2.4",
|
|
78
79
|
"cz-conventional-changelog": "3.3.0",
|
|
79
|
-
"eslint": "8.
|
|
80
|
+
"eslint": "8.15.0",
|
|
80
81
|
"eslint-plugin-header": "3.1.1",
|
|
81
82
|
"eslint-plugin-import": "2.26.0",
|
|
82
83
|
"esmock": "1.7.5",
|
package/src/forms-pipe.js
CHANGED
package/src/json-pipe.js
CHANGED
|
@@ -13,7 +13,7 @@ import fetchMetadata from './steps/fetch-metadata.js';
|
|
|
13
13
|
import setCustomResponseHeaders from './steps/set-custom-response-headers.js';
|
|
14
14
|
import { PipelineResponse } from './PipelineResponse.js';
|
|
15
15
|
import jsonFilter from './utils/json-filter.js';
|
|
16
|
-
import { updateLastModified } from './utils/last-modified.js';
|
|
16
|
+
import { extractLastModified, updateLastModified } from './utils/last-modified.js';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Runs the default pipeline and returns the response.
|
|
@@ -73,7 +73,7 @@ export async function jsonPipe(state, req) {
|
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
// set last-modified
|
|
76
|
-
updateLastModified(state, response, dataResponse.headers
|
|
76
|
+
updateLastModified(state, response, extractLastModified(dataResponse.headers));
|
|
77
77
|
|
|
78
78
|
// set surrogate key
|
|
79
79
|
response.headers.set('x-surrogate-key', `${contentBusId}${path}`.replace(/\//g, '_'));
|
|
@@ -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]) => !
|
|
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
|
}
|
|
@@ -39,8 +39,8 @@ export default async function fetchMetadata(state, req, res) {
|
|
|
39
39
|
}
|
|
40
40
|
state.metadata = data;
|
|
41
41
|
|
|
42
|
-
if (state.type === 'html') {
|
|
43
|
-
// also update last-modified (only for html pipeline)
|
|
42
|
+
if (state.type === 'html' && state.info.selector !== 'plain') {
|
|
43
|
+
// also update last-modified (only for extensionless html pipeline)
|
|
44
44
|
updateLastModified(state, res, extractLastModified(ret.headers));
|
|
45
45
|
}
|
|
46
46
|
return;
|
package/src/steps/render.js
CHANGED
|
@@ -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));
|
|
@@ -41,7 +41,8 @@ export function updateLastModified(state, res, httpDate) {
|
|
|
41
41
|
/**
|
|
42
42
|
* Returns the last modified date from response headers, giving 'x-amz-meta-x-source-last-modified'
|
|
43
43
|
* preference.
|
|
44
|
-
* @param {
|
|
44
|
+
* @param {Map<string, string>} headers
|
|
45
|
+
* @return {string} the last modified date
|
|
45
46
|
*/
|
|
46
47
|
export function extractLastModified(headers) {
|
|
47
48
|
return headers.get('x-amz-meta-x-source-last-modified') ?? headers.get('last-modified');
|