Skip to content

Commit b2de5e9

Browse files
Version Packages (integrations/makeswift)
1 parent e290dd1 commit b2de5e9

File tree

4 files changed

+89
-92
lines changed

4 files changed

+89
-92
lines changed

.changeset/heavy-cups-train.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/wild-bears-open.md

Lines changed: 0 additions & 86 deletions
This file was deleted.

core/CHANGELOG.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,93 @@
11
# Changelog
22

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+
391
## 1.4.2
492

593
### Patch Changes

core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@bigcommerce/catalyst-makeswift",
33
"description": "BigCommerce Catalyst is a Next.js starter kit for building headless BigCommerce storefronts.",
4-
"version": "1.4.2",
4+
"version": "1.4.3",
55
"private": true,
66
"scripts": {
77
"dev": "npm run generate && next dev",

0 commit comments

Comments
 (0)