|
1 | 1 | # Changelog |
2 | 2 |
|
| 3 | +## 1.4.3 |
| 4 | + |
| 5 | +### Patch Changes |
| 6 | + |
| 7 | +- [#2862](https://github.com/bigcommerce/catalyst/pull/2862) [`52207b6`](https://github.com/bigcommerce/catalyst/commit/52207b69c50f58027400f716bf18c53cac82189b) Thanks [@Codeseph](https://github.com/Codeseph)! - fix: handle OPTIONS requests via MakeswiftApiHandler |
| 8 | + |
| 9 | +- [#2860](https://github.com/bigcommerce/catalyst/pull/2860) [`5097034`](https://github.com/bigcommerce/catalyst/commit/5097034e93a9135b646f53445c83c8716fbeb76f) Thanks [@jorgemoya](https://github.com/jorgemoya)! - Add explicit Makeswift SEO metadata support to public-facing pages. When configured in Makeswift, the SEO title and description will take priority over the default values from BigCommerce or static translations. |
| 10 | + |
| 11 | + The following pages now support Makeswift SEO metadata: |
| 12 | + - Home page (`/`) |
| 13 | + - Catch-all page (`/[...rest]`) |
| 14 | + - Product page (`/product/[slug]`) |
| 15 | + - Brand page (`/brand/[slug]`) |
| 16 | + - Category page (`/category/[slug]`) |
| 17 | + - Blog list page (`/blog`) |
| 18 | + - Blog post page (`/blog/[blogId]`) |
| 19 | + - Search page (`/search`) |
| 20 | + - Cart page (`/cart`) |
| 21 | + - Compare page (`/compare`) |
| 22 | + - Gift certificates page (`/gift-certificates`) |
| 23 | + - Gift certificates balance page (`/gift-certificates/balance`) |
| 24 | + - Contact webpage (`/webpages/[id]/contact`) |
| 25 | + - Normal webpage (`/webpages/[id]/normal`) |
| 26 | + |
| 27 | + ## Migration steps |
| 28 | + |
| 29 | + ### Step 1: Add `getMakeswiftPageMetadata` function |
| 30 | + |
| 31 | + Add the `getMakeswiftPageMetadata` function to `core/lib/makeswift/client.ts`: |
| 32 | + |
| 33 | + ```diff |
| 34 | + + export async function getMakeswiftPageMetadata({ path, locale }: { path: string; locale: string }) { |
| 35 | + + const { data: pages } = await client.getPages({ |
| 36 | + + pathPrefix: path, |
| 37 | + + locale: normalizeLocale(locale), |
| 38 | + + siteVersion: await getSiteVersion(), |
| 39 | + + }); |
| 40 | + + |
| 41 | + + if (pages.length === 0 || !pages[0]) { |
| 42 | + + return null; |
| 43 | + + } |
| 44 | + + |
| 45 | + + const { title, description } = pages[0]; |
| 46 | + + |
| 47 | + + return { |
| 48 | + + ...(title && { title }), |
| 49 | + + ...(description && { description }), |
| 50 | + + }; |
| 51 | + + } |
| 52 | + ``` |
| 53 | + |
| 54 | + Export the function from `core/lib/makeswift/index.ts`: |
| 55 | + |
| 56 | + ```diff |
| 57 | + export { Page } from './page'; |
| 58 | + - export { client } from './client'; |
| 59 | + + export { client, getMakeswiftPageMetadata } from './client'; |
| 60 | + ``` |
| 61 | + |
| 62 | + ### Step 2: Update page metadata |
| 63 | + |
| 64 | + Each page's `generateMetadata` function has been updated to fetch Makeswift metadata and use it as the primary source, falling back to existing values. Here's an example using the cart page: |
| 65 | + |
| 66 | + Update `core/app/[locale]/(default)/cart/page.tsx`: |
| 67 | + |
| 68 | + ```diff |
| 69 | + import { getPreferredCurrencyCode } from '~/lib/currency'; |
| 70 | + + import { getMakeswiftPageMetadata } from '~/lib/makeswift'; |
| 71 | + import { Slot } from '~/lib/makeswift/slot'; |
| 72 | + ``` |
| 73 | + |
| 74 | + ```diff |
| 75 | + export async function generateMetadata({ params }: Props): Promise<Metadata> { |
| 76 | + const { locale } = await params; |
| 77 | + |
| 78 | + const t = await getTranslations({ locale, namespace: 'Cart' }); |
| 79 | + + const makeswiftMetadata = await getMakeswiftPageMetadata({ path: '/cart', locale }); |
| 80 | + |
| 81 | + return { |
| 82 | + - title: t('title'), |
| 83 | + + title: makeswiftMetadata?.title || t('title'), |
| 84 | + + description: makeswiftMetadata?.description || undefined, |
| 85 | + }; |
| 86 | + } |
| 87 | + ``` |
| 88 | + |
| 89 | + Apply the same pattern to the other pages listed above, using the appropriate path for each page (e.g., `/blog`, `/search`, `/compare`, etc.). |
| 90 | + |
3 | 91 | ## 1.4.2 |
4 | 92 |
|
5 | 93 | ### Patch Changes |
|
0 commit comments