@adobe/helix-html-pipeline 6.27.26 → 6.27.28

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,17 @@
1
+ ## [6.27.28](https://github.com/adobe/helix-html-pipeline/compare/v6.27.27...v6.27.28) (2026-03-23)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * hreflang attribute values not spec-compliant ([#1053](https://github.com/adobe/helix-html-pipeline/issues/1053)) ([c23294b](https://github.com/adobe/helix-html-pipeline/commit/c23294be68c9a8b54f9f48aca98b7dd50ee118fa))
7
+
8
+ ## [6.27.27](https://github.com/adobe/helix-html-pipeline/compare/v6.27.26...v6.27.27) (2026-03-23)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * hreflang attribute values not spec-compliant ([#1049](https://github.com/adobe/helix-html-pipeline/issues/1049)) ([5299eae](https://github.com/adobe/helix-html-pipeline/commit/5299eaef0a5ee4d6653765651d8e9c33db37a77d))
14
+
1
15
  ## [6.27.26](https://github.com/adobe/helix-html-pipeline/compare/v6.27.25...v6.27.26) (2026-03-19)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "6.27.26",
3
+ "version": "6.27.28",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -17,12 +17,6 @@ import rehypeParse from 'rehype-parse';
17
17
  import { cleanupHeaderValue } from '@adobe/helix-shared-utils';
18
18
  import { contentSecurityPolicyOnAST } from './csp.js';
19
19
 
20
- function formatLang(lang) {
21
- return lang
22
- .replaceAll('_', '-')
23
- .toLowerCase();
24
- }
25
-
26
20
  function appendElement($parent, $el) {
27
21
  if ($el) {
28
22
  $parent.children.push($el);
@@ -83,17 +77,17 @@ export default async function render(state, req, res) {
83
77
  }
84
78
  if (name.toLowerCase() === 'html-lang') {
85
79
  if (value) {
86
- htmlLang = formatLang(value);
80
+ htmlLang = value;
87
81
  }
88
82
  // eslint-disable-next-line no-continue
89
83
  continue;
90
84
  }
91
- if (name.toLowerCase().startsWith('hreflang-')) {
85
+ if (name.startsWith('hreflang-')) {
92
86
  const lang = name.substring(9);
93
87
  if (lang) {
94
88
  appendElement(
95
89
  $head,
96
- createElement('link', 'rel', 'alternate', 'hreflang', formatLang(lang), 'href', value),
90
+ createElement('link', 'rel', 'alternate', 'hreflang', lang, 'href', value),
97
91
  );
98
92
  }
99
93
  // eslint-disable-next-line no-continue
@@ -15,9 +15,12 @@
15
15
  * @returns {string} the meta name
16
16
  */
17
17
  export function toMetaName(text) {
18
- return text
19
- .toLowerCase()
20
- .replace(/[^0-9a-z:_]/gi, '-');
18
+ const name = text.replace(/[^0-9a-zA-Z:_-]/g, '-');
19
+ // preserve case for hreflang language tags (BCP 47)
20
+ if (name.toLowerCase().startsWith('hreflang-')) {
21
+ return `hreflang-${name.substring(9)}`;
22
+ }
23
+ return name.toLowerCase();
21
24
  }
22
25
 
23
26
  export function globToRegExp(glob) {