1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
import type { ChartsHubPage, Lockup } from '@jet-app/app-store/api/models';
import type { SeoData } from '@amp/web-app-components/src/components/MetaTags/types';
import type I18N from '@amp/web-apps-localization';
import { getPlatformFromPage } from '~/utils/seo/common';
import { truncateAroundLimit } from '~/utils/string-formatting';
export function seoDataForChartsHubPage(
page: ChartsHubPage,
i18n: I18N,
language: string,
): SeoData {
const platform = getPlatformFromPage(page);
const title = i18n.t('ASE.Web.AppStore.Meta.TitleWithSiteName', {
title: i18n.t('ASE.Web.AppStore.Meta.ChartsHub.Title', {
platform,
}),
});
let description;
const items = page.charts[0].segments[0].shelves[0].items as Array<Lockup>;
if (items) {
const appsTitles = items.map(({ title }) => title);
description = truncateAroundLimit(
i18n.t('ASE.Web.AppStore.Meta.ChartsHub.Description', {
platform,
listing1: appsTitles[0],
listing2: appsTitles[1],
listing3: appsTitles[2],
listing4: appsTitles[3],
}),
160,
language,
);
}
return {
pageTitle: title,
socialTitle: title,
appleTitle: title,
description,
socialDescription: description,
appleDescription: description,
};
}
|