summaryrefslogtreecommitdiff
path: root/src/utils/seo/app-event-detail-page.ts
diff options
context:
space:
mode:
authorrxliuli <rxliuli@gmail.com>2025-11-04 05:03:50 +0800
committerrxliuli <rxliuli@gmail.com>2025-11-04 05:03:50 +0800
commitbce557cc2dc767628bed6aac87301a1be7c5431b (patch)
treeb51a051228d01fe3306cd7626d4a96768aadb944 /src/utils/seo/app-event-detail-page.ts
init commit
Diffstat (limited to 'src/utils/seo/app-event-detail-page.ts')
-rw-r--r--src/utils/seo/app-event-detail-page.ts43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/utils/seo/app-event-detail-page.ts b/src/utils/seo/app-event-detail-page.ts
new file mode 100644
index 0000000..7b6c270
--- /dev/null
+++ b/src/utils/seo/app-event-detail-page.ts
@@ -0,0 +1,43 @@
+import type { GenericPage } from '@jet-app/app-store/api/models';
+import type I18N from '@amp/web-apps-localization';
+import type { SeoData } from '@amp/web-app-components/src/components/MetaTags/types';
+
+import { isAppEventDetailShelf } from '~/components/jet/shelf/AppEventDetailShelf.svelte';
+import { truncateAroundLimit } from '~/utils/string-formatting';
+import { MAX_DESCRIPTION_LENGTH } from '~/utils/seo/common';
+
+export function seoDataForAppEventDetailPage(
+ page: GenericPage,
+ i18n: I18N,
+ language: string,
+): SeoData {
+ const appEventDetailShelf = page.shelves.find(isAppEventDetailShelf);
+
+ const { appEvent } = appEventDetailShelf?.items[0] || {};
+
+ if (!appEvent) {
+ return {};
+ }
+
+ const title = appEvent.title;
+ const description = truncateAroundLimit(
+ appEvent.detail,
+ MAX_DESCRIPTION_LENGTH,
+ language,
+ );
+
+ return {
+ pageTitle: title,
+ socialTitle: title,
+ appleTitle: title,
+ description,
+ socialDescription: description,
+ appleDescription: description,
+ crop: 'fo',
+ twitterCropCode: 'fo',
+ artworkUrl: appEvent?.moduleArtwork?.template,
+ imageAltTitle: i18n.t('ASE.Web.AppStore.Meta.Image.AltText', {
+ title: title,
+ }),
+ };
+}