@f5-sales-demo/docs-theme 4.6.1 → 4.7.1
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/README.md +10 -0
- package/assets/canada-favicon.svg +4 -0
- package/assets/canada-flag.svg +4 -0
- package/assets/flag-icons-LICENSE.txt +21 -0
- package/config.ts +24 -4
- package/package.json +4 -2
- package/src/utils/localize-ecosystem-href.ts +3 -1
- package/src/utils/publication-profiles.test.ts +19 -0
- package/src/utils/publication-profiles.ts +15 -0
package/README.md
CHANGED
|
@@ -33,3 +33,13 @@ branch naming, and CI requirements.
|
|
|
33
33
|
## License
|
|
34
34
|
|
|
35
35
|
See [LICENSE](LICENSE).
|
|
36
|
+
|
|
37
|
+
## Canadian flag artwork
|
|
38
|
+
|
|
39
|
+
`assets/canada-flag.svg` is the unmodified Canadian 4:3 flag from
|
|
40
|
+
[flag-icons v7.5.0](https://github.com/lipis/flag-icons/tree/v7.5.0).
|
|
41
|
+
`assets/canada-favicon.svg` centers the same flag on a square white canvas.
|
|
42
|
+
Copyright and MIT license terms are retained in
|
|
43
|
+
[assets/flag-icons-LICENSE.txt](assets/flag-icons-LICENSE.txt).
|
|
44
|
+
The Canada publication profile preserves English routing and selects its local flag favicon.
|
|
45
|
+
Callers can override the optional `favicon` field in `createF5xcDocsConfig`.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><rect width="640" height="640" fill="#fff"/><g transform="translate(0 80)">
|
|
2
|
+
<path fill="#fff" d="M150.1 0h339.7v480H150z"/>
|
|
3
|
+
<path fill="#d52b1e" d="M-19.7 0h169.8v480H-19.7zm509.5 0h169.8v480H489.9zM201 232l-13.3 4.4 61.4 54c4.7 13.7-1.6 17.8-5.6 25l66.6-8.4-1.6 67 13.9-.3-3.1-66.6 66.7 8c-4.1-8.7-7.8-13.3-4-27.2l61.3-51-10.7-4c-8.8-6.8 3.8-32.6 5.6-48.9 0 0-35.7 12.3-38 5.8l-9.2-17.5-32.6 35.8c-3.5.9-5-.5-5.9-3.5l15-74.8-23.8 13.4q-3.2 1.3-5.2-2.2l-23-46-23.6 47.8q-2.8 2.5-5 .7L264 130.8l13.7 74.1c-1.1 3-3.7 3.8-6.7 2.2l-31.2-35.3c-4 6.5-6.8 17.1-12.2 19.5s-23.5-4.5-35.6-7c4.2 14.8 17 39.6 9 47.7"/>
|
|
4
|
+
</g></svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-ca" viewBox="0 0 640 480">
|
|
2
|
+
<path fill="#fff" d="M150.1 0h339.7v480H150z"/>
|
|
3
|
+
<path fill="#d52b1e" d="M-19.7 0h169.8v480H-19.7zm509.5 0h169.8v480H489.9zM201 232l-13.3 4.4 61.4 54c4.7 13.7-1.6 17.8-5.6 25l66.6-8.4-1.6 67 13.9-.3-3.1-66.6 66.7 8c-4.1-8.7-7.8-13.3-4-27.2l61.3-51-10.7-4c-8.8-6.8 3.8-32.6 5.6-48.9 0 0-35.7 12.3-38 5.8l-9.2-17.5-32.6 35.8c-3.5.9-5-.5-5.9-3.5l15-74.8-23.8 13.4q-3.2 1.3-5.2-2.2l-23-46-23.6 47.8q-2.8 2.5-5 .7L264 130.8l13.7 74.1c-1.1 3-3.7 3.8-6.7 2.2l-31.2-35.3c-4 6.5-6.8 17.1-12.2 19.5s-23.5-4.5-35.6-7c4.2 14.8 17 39.6 9 47.7"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013 Panayiotis Lipiridis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
10
|
+
so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/config.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { unified } from '@astrojs/markdown-remark';
|
|
|
4
4
|
import react from '@astrojs/react';
|
|
5
5
|
import starlight from '@astrojs/starlight';
|
|
6
6
|
import type { StarlightPlugin } from '@astrojs/starlight/types';
|
|
7
|
-
import { BCP47_TO_SLUG
|
|
7
|
+
import { BCP47_TO_SLUG } from '@f5-sales-demo/i18n-core';
|
|
8
8
|
import starlightLlmsTxt from '@f5-sales-demo/starlight-llms-txt';
|
|
9
9
|
import type { MegaMenuItem } from '@f5-sales-demo/starlight-mega-menu';
|
|
10
10
|
import starlightMegaMenu from '@f5-sales-demo/starlight-mega-menu';
|
|
@@ -35,6 +35,7 @@ import canonicalLlms from './src/utils/canonical-llms.mjs';
|
|
|
35
35
|
import { providerMegaMenu } from './src/utils/canonical-provider.ts';
|
|
36
36
|
import { menuLocalizationPolicy } from './src/utils/menu-localization.ts';
|
|
37
37
|
import { stagedProviderSections } from './src/utils/provider-sections.ts';
|
|
38
|
+
import { repositoryPublicationProfile } from './src/utils/publication-profiles.ts';
|
|
38
39
|
import { resolveMegaMenuIcon } from './src/utils/resolve-icon.ts';
|
|
39
40
|
import providerSharedAssets from './src/utils/share-provider-assets.mjs';
|
|
40
41
|
import { buildSubcategorySidebar } from './src/utils/subcategory-sidebar.ts';
|
|
@@ -116,6 +117,7 @@ export interface F5xcDocsConfigOptions {
|
|
|
116
117
|
additionalRemarkPlugins?: Array<unknown>;
|
|
117
118
|
megaMenuItems?: MegaMenuItem[];
|
|
118
119
|
head?: HeadEntry[];
|
|
120
|
+
favicon?: string;
|
|
119
121
|
logo?: { src: string } | { light: string; dark: string };
|
|
120
122
|
federatedSearch?: boolean;
|
|
121
123
|
locales?: Record<string, { label: string; lang: string; dir?: 'rtl' }> | false;
|
|
@@ -252,6 +254,19 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
252
254
|
href: 'https://f5-sales-demo.github.io/multi-cloud-networking/',
|
|
253
255
|
icon: resolveMegaMenuIcon('f5xc:multi-cloud-network-connect'),
|
|
254
256
|
},
|
|
257
|
+
{
|
|
258
|
+
label: 'Canada Topology',
|
|
259
|
+
description: 'Canadian hosting and regional access control',
|
|
260
|
+
href: 'https://f5-sales-demo.github.io/canada/',
|
|
261
|
+
icon: {
|
|
262
|
+
body: fs
|
|
263
|
+
.readFileSync(new URL('./assets/canada-flag.svg', import.meta.url), 'utf8')
|
|
264
|
+
.replace(/<svg[^>]*>|<\/svg>/g, ''),
|
|
265
|
+
width: 640,
|
|
266
|
+
height: 480,
|
|
267
|
+
mode: 'original',
|
|
268
|
+
},
|
|
269
|
+
},
|
|
255
270
|
{
|
|
256
271
|
label: 'Content Delivery',
|
|
257
272
|
translations: itemLabels['Content Delivery'],
|
|
@@ -639,6 +654,7 @@ export const federatedSearchSites = [
|
|
|
639
654
|
{ repo: 'observability', label: 'Observability' },
|
|
640
655
|
{ repo: 'was', label: 'Web App Scanning' },
|
|
641
656
|
{ repo: 'multi-cloud-networking', label: 'Multi-Cloud Networking' },
|
|
657
|
+
{ repo: 'canada', label: 'Canada Topology' },
|
|
642
658
|
{ repo: 'dns', label: 'DNS' },
|
|
643
659
|
{ repo: 'cdn', label: 'CDN' },
|
|
644
660
|
{ repo: 'bot-standard', label: 'Bot Standard' },
|
|
@@ -681,6 +697,8 @@ export function createF5xcDocsConfig(options: F5xcDocsConfigOptions = {}) {
|
|
|
681
697
|
const title = options.title || process.env.DOCS_TITLE || (canonicalProvider ? 'Terraform Provider' : 'Documentation');
|
|
682
698
|
const description = options.description || process.env.DOCS_DESCRIPTION || '';
|
|
683
699
|
const githubRepository = options.githubRepository || process.env.GITHUB_REPOSITORY || '';
|
|
700
|
+
const publicationProfile = repositoryPublicationProfile(githubRepository);
|
|
701
|
+
const favicon = options.favicon || publicationProfile?.favicon;
|
|
684
702
|
let llmsOptionalLinks: Array<{ title: string; url: string }> = options.llmsOptionalLinks || [];
|
|
685
703
|
if (!options.llmsOptionalLinks && process.env.LLMS_OPTIONAL_LINKS) {
|
|
686
704
|
try {
|
|
@@ -815,6 +833,7 @@ export function createF5xcDocsConfig(options: F5xcDocsConfigOptions = {}) {
|
|
|
815
833
|
tieredHierarchy: true,
|
|
816
834
|
promote: llmsConfig.promote || ['index*', 'overview*'],
|
|
817
835
|
demote: llmsConfig.demote || ['references*'],
|
|
836
|
+
...(llmsConfig.exclude ? { exclude: llmsConfig.exclude } : {}),
|
|
818
837
|
...(llmsFederatedSites.length > 0 ? { federatedSites: llmsFederatedSites } : {}),
|
|
819
838
|
...(llmsFederatedSiteCategories.length > 0 ? { federatedSiteCategories: llmsFederatedSiteCategories } : {}),
|
|
820
839
|
...(progressiveCorpus ? { progressiveCorpus } : {}),
|
|
@@ -832,13 +851,13 @@ export function createF5xcDocsConfig(options: F5xcDocsConfigOptions = {}) {
|
|
|
832
851
|
const resolvedLocales =
|
|
833
852
|
canonicalProvider || options.locales === false
|
|
834
853
|
? undefined
|
|
835
|
-
: options.locales || (hasEnSubdir ? f5xcDefaultLocales : undefined);
|
|
836
|
-
const resolvedDefaultLocale = options.defaultLocale || f5xcDefaultLocale;
|
|
854
|
+
: options.locales || publicationProfile?.locales || (hasEnSubdir ? f5xcDefaultLocales : undefined);
|
|
855
|
+
const resolvedDefaultLocale = options.defaultLocale || publicationProfile?.defaultLocale || f5xcDefaultLocale;
|
|
837
856
|
|
|
838
857
|
const localeHeadScripts: HeadEntry[] = [];
|
|
839
858
|
if (resolvedLocales) {
|
|
840
859
|
const langToSlugMap = BCP47_TO_SLUG;
|
|
841
|
-
const slugSet = JSON.stringify(
|
|
860
|
+
const slugSet = JSON.stringify(Object.keys(resolvedLocales));
|
|
842
861
|
|
|
843
862
|
localeHeadScripts.push({
|
|
844
863
|
tag: 'script',
|
|
@@ -905,6 +924,7 @@ export function createF5xcDocsConfig(options: F5xcDocsConfigOptions = {}) {
|
|
|
905
924
|
head: [...((head as Parameters<typeof starlight>[0]['head']) || []), ...localeHeadScripts] as Parameters<
|
|
906
925
|
typeof starlight
|
|
907
926
|
>[0]['head'],
|
|
927
|
+
...(favicon ? { favicon } : {}),
|
|
908
928
|
logo: logo as Parameters<typeof starlight>[0]['logo'],
|
|
909
929
|
...(resolvedLocales ? { locales: resolvedLocales, defaultLocale: resolvedDefaultLocale } : {}),
|
|
910
930
|
...(subcategorySidebar
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@f5-sales-demo/docs-theme",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.1",
|
|
4
4
|
"description": "F5 Distributed Cloud branded Starlight documentation theme",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -44,7 +44,9 @@
|
|
|
44
44
|
"./canonical-route-middleware": "./canonical-route-middleware.ts",
|
|
45
45
|
"./components/ProviderSidebar.astro": "./components/ProviderSidebar.astro",
|
|
46
46
|
"./components/ProviderHeader.astro": "./components/ProviderHeader.astro",
|
|
47
|
-
"./components/SharedHeader.astro": "./components/SharedHeader.astro"
|
|
47
|
+
"./components/SharedHeader.astro": "./components/SharedHeader.astro",
|
|
48
|
+
"./assets/canada-flag.svg": "./assets/canada-flag.svg",
|
|
49
|
+
"./assets/canada-favicon.svg": "./assets/canada-favicon.svg"
|
|
48
50
|
},
|
|
49
51
|
"files": [
|
|
50
52
|
"index.ts",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { bcp47ToSlug, VALID_SLUGS } from '@f5-sales-demo/i18n-core';
|
|
2
|
+
import { publicationProfiles } from './publication-profiles';
|
|
2
3
|
|
|
3
4
|
const ECOSYSTEM_HOST = 'f5-sales-demo.github.io';
|
|
4
5
|
|
|
@@ -34,7 +35,8 @@ export function localizeEcosystemHref(
|
|
|
34
35
|
return href;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
segments
|
|
38
|
+
const profile = publicationProfiles[segments[0]];
|
|
39
|
+
segments.splice(1, 0, profile ? profile.defaultLocale : localeSlug);
|
|
38
40
|
url.pathname = `/${segments.join('/')}/`;
|
|
39
41
|
|
|
40
42
|
return url.toString();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { localizeEcosystemHref } from './localize-ecosystem-href';
|
|
3
|
+
import { repositoryPublicationProfile } from './publication-profiles';
|
|
4
|
+
|
|
5
|
+
describe('Canadian publication', () => {
|
|
6
|
+
it('publishes only English and selects the flag favicon', () => {
|
|
7
|
+
expect(repositoryPublicationProfile('f5-sales-demo/canada')).toEqual({
|
|
8
|
+
locales: { en: { label: 'English', lang: 'en' } },
|
|
9
|
+
defaultLocale: 'en',
|
|
10
|
+
favicon: '/assets/canada-favicon.svg',
|
|
11
|
+
});
|
|
12
|
+
expect(repositoryPublicationProfile('f5-sales-demo/multi-cloud-networking')).toBeUndefined();
|
|
13
|
+
});
|
|
14
|
+
it('routes foreign-language ecosystem visitors to available English content', () => {
|
|
15
|
+
expect(localizeEcosystemHref('https://f5-sales-demo.github.io/canada/', 'fr')).toBe(
|
|
16
|
+
'https://f5-sales-demo.github.io/canada/en/',
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Repository publication decisions shared by navigation and site configuration. */
|
|
2
|
+
export const publicationProfiles: Record<
|
|
3
|
+
string,
|
|
4
|
+
{ locales: Record<string, { label: string; lang: string }>; defaultLocale: string; favicon: string }
|
|
5
|
+
> = {
|
|
6
|
+
canada: {
|
|
7
|
+
locales: { en: { label: 'English', lang: 'en' } },
|
|
8
|
+
defaultLocale: 'en',
|
|
9
|
+
favicon: '/assets/canada-favicon.svg',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export function repositoryPublicationProfile(repository: string) {
|
|
14
|
+
return publicationProfiles[repository.split('/').pop() || ''];
|
|
15
|
+
}
|