@f5-sales-demo/docs-theme 3.9.10 → 3.9.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@f5-sales-demo/docs-theme",
3
- "version": "3.9.10",
3
+ "version": "3.9.11",
4
4
  "description": "F5 Distributed Cloud branded Starlight documentation theme",
5
5
  "type": "module",
6
6
  "bin": {
@@ -62,4 +62,14 @@ describe('localizeEcosystemHref', () => {
62
62
  const result = localizeEcosystemHref('https://custom.host.io/waf/', 'fr', 'custom.host.io');
63
63
  expect(result).toBe('https://custom.host.io/waf/fr/');
64
64
  });
65
+
66
+ it('does not localize single-locale ecosystem sites (would 404)', () => {
67
+ // These sites have no /<locale>/ path; injecting one produces a 404.
68
+ expect(localizeEcosystemHref('https://f5-sales-demo.github.io/terraform-provider-xcsh/', 'fr')).toBe(
69
+ 'https://f5-sales-demo.github.io/terraform-provider-xcsh/',
70
+ );
71
+ expect(localizeEcosystemHref('https://f5-sales-demo.github.io/docs-control/', 'ja')).toBe(
72
+ 'https://f5-sales-demo.github.io/docs-control/',
73
+ );
74
+ });
65
75
  });
@@ -2,6 +2,11 @@ import { bcp47ToSlug, VALID_SLUGS } from '@f5-sales-demo/i18n-core';
2
2
 
3
3
  const ECOSYSTEM_HOST = 'f5-sales-demo.github.io';
4
4
 
5
+ // Ecosystem sites published as a single locale (no `/<locale>/` path segment).
6
+ // Injecting a locale slug into links to these produces a 404
7
+ // (e.g. `/terraform-provider-xcsh/en/`), so they are left unlocalized.
8
+ const NON_LOCALIZED_ECOSYSTEM_SLUGS = new Set(['terraform-provider-xcsh', 'docs-control']);
9
+
5
10
  export const langToSlug = bcp47ToSlug;
6
11
 
7
12
  export function localizeEcosystemHref(
@@ -23,6 +28,8 @@ export function localizeEcosystemHref(
23
28
  const segments = url.pathname.split('/').filter(Boolean);
24
29
  if (segments.length === 0) return href;
25
30
 
31
+ if (NON_LOCALIZED_ECOSYSTEM_SLUGS.has(segments[0])) return href;
32
+
26
33
  if (segments.length >= 2 && VALID_SLUGS.has(segments[1])) {
27
34
  return href;
28
35
  }