/ src / utils / seo / see-all-page.ts
see-all-page.ts
 1  import type I18N from '@amp/web-apps-localization';
 2  import type { SeeAllPage } from '@jet-app/app-store/api/models';
 3  import type { SeoData } from '@amp/web-app-components/src/components/MetaTags/types';
 4  
 5  export function seoDataForSeeAllPage(page: SeeAllPage, i18n: I18N): SeoData {
 6      let title = i18n.t('ASE.Web.AppStore.Meta.Product.Title');
 7      const shelfName = {
 8          reviews: 'productRatings',
 9          'customers-also-bought-apps': 'similarItems',
10          'developer-other-apps': 'moreByDeveloper',
11      }[page.seeAllType];
12  
13      if (shelfName) {
14          const shelf = page.shelfMapping[shelfName];
15          title = `${page.title} - ${shelf.title}`;
16      }
17  
18      const titleWithSiteName = i18n.t(
19          'ASE.Web.AppStore.Meta.TitleWithSiteName',
20          { title },
21      );
22  
23      const descriptionLocKey =
24          {
25              reviews: 'ASE.Web.AppStore.SeeAll.Reviews.Meta.Description',
26              'customers-also-bought-apps':
27                  'ASE.Web.AppStore.SeeAll.CustomersAlsoBoughtApps.Meta.Description',
28              'developer-other-apps':
29                  'ASE.Web.AppStore.SeeAll.DeveloperOtherApps.Meta.Description',
30          }[page.seeAllType] ||
31          'ASE.Web.AppStore.Meta.Product.DescriptionWithoutDeveloperName';
32      const description = i18n.t(descriptionLocKey, {
33          appName: page.title,
34      });
35  
36      const artworkUrl = page.lockup.icon?.template;
37  
38      return {
39          pageTitle: titleWithSiteName,
40          socialTitle: titleWithSiteName,
41          appleTitle: titleWithSiteName,
42          description,
43          socialDescription: description,
44          appleDescription: description,
45          artworkUrl,
46      };
47  }