Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSTEAM1-1436 & WSTEAM1-1437: Gahuza footer updates for .lite launch #12161

Merged
merged 5 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/lib/config/services/gahuza.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ export const service: DefaultServiceConfig = {
text: 'Vugana na BBC',
},
{
href: 'https://www.bbc.com/ws/languages',
text: 'Other Languages',
href: 'https://www.bbc.com/ws/languages?xtor=CS1-13-[wsgahuza~N~A39~MBC]-[Owned]&utm_source=mktg',
text: 'Bona amakuru mu zindi ndimi',
},
{
id: 'COOKIE_SETTINGS',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ exports[`Canonical Live Radio Footer Anchors should match text and url 7`] = `

exports[`Canonical Live Radio Footer Anchors should match text and url 8`] = `
{
"text": "Other Languages",
"url": "https://www.bbc.com/ws/languages",
"text": "Bona amakuru mu zindi ndimi",
"url": "https://www.bbc.com/ws/languages?xtor=CS1-13-[wsgahuza~N~A39~MBC]-[Owned]&utm_source=mktg",
}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ exports[`Canonical On Demand Audio Page Footer Anchors should match text and url

exports[`Canonical On Demand Audio Page Footer Anchors should match text and url 8`] = `
{
"text": "Other Languages",
"url": "https://www.bbc.com/ws/languages",
"text": "Bona amakuru mu zindi ndimi",
"url": "https://www.bbc.com/ws/languages?xtor=CS1-13-[wsgahuza~N~A39~MBC]-[Owned]&utm_source=mktg",
}
`;

Expand Down
11 changes: 11 additions & 0 deletions src/server/Document/Renderers/litePageTransforms/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,16 @@ describe('litePageTransforms', () => {

expect(modifiedHtml).toEqual(originalHtml);
});

it('should not append .lite suffix when href is restricted on soft launch', () => {
const originalHtml = `
<a href="https://www.bbc.com/ws/languages">Other Languages</a>
<a href="https://www.bbc.com/ws/languages?xtor=CS1-13-[wsgahuza~N~A39~MBC]-[Owned]&utm_source=mktg">Other Languages</a>
`;

const modifiedHtml = litePageTransforms(originalHtml);

expect(modifiedHtml).toEqual(originalHtml);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import services from '#lib/config/services/loadableConfig';

const SERVICES = Object.keys(services) as Services[];

const RESTRICTED_ON_SOFT_LAUNCH = ['/ws/languages'];

const VALID_DOMAINS = [
'/',
'localhost',
Expand All @@ -22,6 +24,9 @@ const addLiteExtension = (href?: string) => {
const extension = url.pathname?.split('.')?.pop() || '';

const isValidDomain = VALID_DOMAINS.includes(url.hostname);
const isRestrictedOnSoftLaunch = RESTRICTED_ON_SOFT_LAUNCH.includes(
url.pathname,
);
const isWsService = SERVICES.includes(
url.pathname?.split('/')?.[1] as Services,
);
Expand All @@ -30,7 +35,10 @@ const addLiteExtension = (href?: string) => {
RESERVED_ROUTE_EXTENSIONS.includes(extension);

const shouldAddLiteExtension =
isValidDomain && isWsService && !hasReservedRouteExtension;
isValidDomain &&
isWsService &&
!hasReservedRouteExtension &&
!isRestrictedOnSoftLaunch;

if (shouldAddLiteExtension) {
url.pathname += '.lite';
Expand Down
Loading