@adobe/helix-html-pipeline 6.21.5 → 6.22.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 +14 -0
- package/package.json +3 -3
- package/src/steps/render.js +21 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [6.22.0](https://github.com/adobe/helix-html-pipeline/compare/v6.21.6...v6.22.0) (2025-03-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **metadata:** hreflang links ([#847](https://github.com/adobe/helix-html-pipeline/issues/847)) ([fe0ded5](https://github.com/adobe/helix-html-pipeline/commit/fe0ded545b69d8a1157cd5952725a9cc222dcbda))
|
|
7
|
+
|
|
8
|
+
## [6.21.6](https://github.com/adobe/helix-html-pipeline/compare/v6.21.5...v6.21.6) (2025-03-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @adobe/remark-gridtables to v3.0.12 ([#838](https://github.com/adobe/helix-html-pipeline/issues/838)) ([e609c76](https://github.com/adobe/helix-html-pipeline/commit/e609c769458cb8584c9a8351faecc366f3141893))
|
|
14
|
+
|
|
1
15
|
## [6.21.5](https://github.com/adobe/helix-html-pipeline/compare/v6.21.4...v6.21.5) (2025-03-09)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-html-pipeline",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.22.0",
|
|
4
4
|
"description": "Helix HTML Pipeline",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@adobe/helix-markdown-support": "7.1.12",
|
|
46
46
|
"@adobe/helix-shared-utils": "3.0.2",
|
|
47
47
|
"@adobe/mdast-util-gridtables": "4.0.11",
|
|
48
|
-
"@adobe/remark-gridtables": "3.0.
|
|
48
|
+
"@adobe/remark-gridtables": "3.0.12",
|
|
49
49
|
"github-slugger": "2.0.0",
|
|
50
50
|
"hast-util-raw": "9.1.0",
|
|
51
51
|
"hast-util-select": "6.0.4",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"js-yaml": "4.1.0",
|
|
86
86
|
"jsdom": "26.0.0",
|
|
87
87
|
"junit-report-builder": "5.1.1",
|
|
88
|
-
"lint-staged": "15.
|
|
88
|
+
"lint-staged": "15.5.0",
|
|
89
89
|
"mocha": "11.1.0",
|
|
90
90
|
"mocha-multi-reporters": "1.5.1",
|
|
91
91
|
"mocha-suppress-logs": "0.5.1",
|
package/src/steps/render.js
CHANGED
|
@@ -17,6 +17,14 @@ import rehypeParse from 'rehype-parse';
|
|
|
17
17
|
import { cleanupHeaderValue } from '@adobe/helix-shared-utils';
|
|
18
18
|
import { contentSecurityPolicyOnAST } from './csp.js';
|
|
19
19
|
|
|
20
|
+
const LANG_REGEX = /^[a-z]{2}(?:[-_][a-z]{2})?$/i;
|
|
21
|
+
|
|
22
|
+
function formatLang(lang) {
|
|
23
|
+
return lang
|
|
24
|
+
.replace('_', '-')
|
|
25
|
+
.toLowerCase();
|
|
26
|
+
}
|
|
27
|
+
|
|
20
28
|
function appendElement($parent, $el) {
|
|
21
29
|
if ($el) {
|
|
22
30
|
$parent.children.push($el);
|
|
@@ -76,8 +84,19 @@ export default async function render(state, req, res) {
|
|
|
76
84
|
continue;
|
|
77
85
|
}
|
|
78
86
|
if (name.toLowerCase() === 'html-lang') {
|
|
79
|
-
if (
|
|
80
|
-
htmlLang = value;
|
|
87
|
+
if (LANG_REGEX.test(value)) {
|
|
88
|
+
htmlLang = formatLang(value);
|
|
89
|
+
}
|
|
90
|
+
// eslint-disable-next-line no-continue
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (name.toLowerCase().startsWith('hreflang-')) {
|
|
94
|
+
const lang = name.substring(9);
|
|
95
|
+
if (LANG_REGEX.test(lang)) {
|
|
96
|
+
appendElement(
|
|
97
|
+
$head,
|
|
98
|
+
createElement('link', 'rel', 'alternate', 'hreflang', formatLang(lang), 'href', value),
|
|
99
|
+
);
|
|
81
100
|
}
|
|
82
101
|
// eslint-disable-next-line no-continue
|
|
83
102
|
continue;
|