@adobe/helix-html-pipeline 1.4.2 → 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 +7 -0
- package/package.json +1 -1
- package/src/steps/extract-metadata.js +6 -1
- package/src/steps/render.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
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
|
+
|
|
1
8
|
## [1.4.2](https://github.com/adobe/helix-html-pipeline/compare/v1.4.1...v1.4.2) (2022-05-03)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -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
|
}
|
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));
|