@adobe/helix-html-pipeline 6.20.4 → 6.21.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/render.js +10 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [6.21.0](https://github.com/adobe/helix-html-pipeline/compare/v6.20.4...v6.21.0) (2025-02-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **metadata:** html lang attribute ([#824](https://github.com/adobe/helix-html-pipeline/issues/824)) ([fc26c60](https://github.com/adobe/helix-html-pipeline/commit/fc26c608e5a5b61215f1592065a86a0e50d57fa8))
|
|
7
|
+
|
|
1
8
|
## [6.20.4](https://github.com/adobe/helix-html-pipeline/compare/v6.20.3...v6.20.4) (2025-02-24)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/steps/render.js
CHANGED
|
@@ -67,12 +67,21 @@ export default async function render(state, req, res) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
let jsonLd;
|
|
70
|
+
let htmlLang;
|
|
71
|
+
|
|
70
72
|
for (const [name, value] of Object.entries(meta.page)) {
|
|
71
73
|
if (name.toLowerCase() === 'json-ld') {
|
|
72
74
|
jsonLd = value;
|
|
73
75
|
// eslint-disable-next-line no-continue
|
|
74
76
|
continue;
|
|
75
77
|
}
|
|
78
|
+
if (name.toLowerCase() === 'html-lang') {
|
|
79
|
+
if (/^[a-z]{2}([-_]{1}[A-Z]{2})?$/.test(value)) {
|
|
80
|
+
htmlLang = value;
|
|
81
|
+
}
|
|
82
|
+
// eslint-disable-next-line no-continue
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
76
85
|
const attr = name.includes(':') && !name.startsWith('twitter:') ? 'property' : 'name';
|
|
77
86
|
if (Array.isArray(value)) {
|
|
78
87
|
for (const v of value) {
|
|
@@ -111,7 +120,7 @@ export default async function render(state, req, res) {
|
|
|
111
120
|
type: 'root',
|
|
112
121
|
children: [
|
|
113
122
|
{ type: 'doctype' },
|
|
114
|
-
h('html', [
|
|
123
|
+
h('html', htmlLang ? { lang: htmlLang } : null, [
|
|
115
124
|
$head,
|
|
116
125
|
h('body', [
|
|
117
126
|
h('header', []), // todo: are those still required ?
|