@graphcommerce/magento-category 4.2.2 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1588](https://github.com/graphcommerce-org/graphcommerce/pull/1588) [`42030e04b`](https://github.com/graphcommerce-org/graphcommerce/commit/42030e04b2ebe004379c6f052e10407c2f5df18f) Thanks [@paales](https://github.com/paales)! - Make sure the canonical of a page doesn’t contain a double forward slash
8
+
9
+ - Updated dependencies [[`b6d3a3c13`](https://github.com/graphcommerce-org/graphcommerce/commit/b6d3a3c13ea63ef0f691f497507f07c0e094de5b)]:
10
+ - @graphcommerce/next-ui@4.19.0
11
+ - @graphcommerce/framer-scroller@2.1.30
12
+ - @graphcommerce/magento-product@4.4.23
13
+ - @graphcommerce/magento-store@4.2.25
14
+
15
+ ## 4.3.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#1577](https://github.com/graphcommerce-org/graphcommerce/pull/1577) [`ad55e6c50`](https://github.com/graphcommerce-org/graphcommerce/commit/ad55e6c50c3a3223ee2c17826881808fa9d8f27c) Thanks [@mikekeehnen](https://github.com/mikekeehnen)! - Added improvements voor the category pages' meta description
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [[`6ce2cbaf2`](https://github.com/graphcommerce-org/graphcommerce/commit/6ce2cbaf2cf27e21b753f7cb71e7e74826294de6), [`6ce2cbaf2`](https://github.com/graphcommerce-org/graphcommerce/commit/6ce2cbaf2cf27e21b753f7cb71e7e74826294de6), [`6ce2cbaf2`](https://github.com/graphcommerce-org/graphcommerce/commit/6ce2cbaf2cf27e21b753f7cb71e7e74826294de6)]:
24
+ - @graphcommerce/magento-product@4.4.22
25
+ - @graphcommerce/graphql@3.4.5
26
+ - @graphcommerce/next-ui@4.18.0
27
+ - @graphcommerce/magento-store@4.2.24
28
+ - @graphcommerce/framer-scroller@2.1.29
29
+
30
+ ## 4.2.3
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [[`bfbcd59d8`](https://github.com/graphcommerce-org/graphcommerce/commit/bfbcd59d8f7652d7a7c028f79cc994216e8dbe3a), [`49370878a`](https://github.com/graphcommerce-org/graphcommerce/commit/49370878a48b90a4579026a7c56c54f97840cebb), [`b6ce5548c`](https://github.com/graphcommerce-org/graphcommerce/commit/b6ce5548c66a8ca62d3aee29467045f7f07f30c8)]:
35
+ - @graphcommerce/magento-product@4.4.21
36
+ - @graphcommerce/graphql@3.4.4
37
+ - @graphcommerce/next-ui@4.17.0
38
+ - @graphcommerce/magento-store@4.2.23
39
+ - @graphcommerce/framer-scroller@2.1.28
40
+
3
41
  ## 4.2.2
4
42
 
5
43
  ### Patch Changes
@@ -1,32 +1,50 @@
1
1
  import { ProductListParams } from '@graphcommerce/magento-product'
2
2
  import { PageMeta } from '@graphcommerce/magento-store'
3
3
  import { PageMetaProps } from '@graphcommerce/next-ui'
4
+ import { i18n } from '@lingui/core'
4
5
  import { CategoryMetaFragment } from './CategoryMeta.gql'
5
6
 
6
- type CategoryMetaProps = CategoryMetaFragment &
7
- Omit<PageMetaProps, 'title' | 'metaDescription'> & {
7
+ export type CategoryMetaProps = CategoryMetaFragment &
8
+ Partial<PageMetaProps> & {
8
9
  params?: ProductListParams
9
10
  current_page?: number | null | undefined
10
11
  }
11
12
 
12
13
  export function CategoryMeta(props: CategoryMetaProps) {
13
- const { name, meta_title, meta_description, current_page, params, ...pageMetaProps } = props
14
+ const { meta_title, meta_description, name, params, current_page } = props
15
+ let {
16
+ title = meta_title ?? name ?? '',
17
+ metaDescription = meta_description ?? undefined,
18
+ metaRobots,
19
+ canonical,
20
+ } = props
21
+
22
+ if (params?.url && !canonical) canonical = `/${params.url}`
23
+
14
24
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
15
25
  const anyFilterActive = Object.keys(params?.filters ?? {}).length > 0
26
+ const currentPage = params?.currentPage ?? 1
27
+ const isPaginated = currentPage > 1 && !anyFilterActive
28
+
29
+ const titleTrans =
30
+ title && isPaginated
31
+ ? i18n._(/* i18n */ '{title} - Page {currentPage}', { title, currentPage })
32
+ : title
33
+
34
+ const metaDescriptionTrans =
35
+ metaDescription && isPaginated
36
+ ? i18n._(/* i18n */ '{metaDescription} - Page {currentPage}', {
37
+ metaDescription,
38
+ currentPage,
39
+ })
40
+ : metaDescription
16
41
 
17
42
  return (
18
43
  <PageMeta
19
- title={`${meta_title ?? name ?? ''} ${
20
- current_page && current_page > 1 ? `- Page ${current_page}` : ''
21
- }`}
22
- metaDescription={`${meta_description ?? undefined} ${
23
- current_page && current_page > 1 ? `- Page ${current_page}` : ''
24
- }`}
25
- metaRobots={anyFilterActive ? ['noindex'] : undefined}
26
- canonical={`/${params?.url}${
27
- (params?.currentPage ?? 1) > 1 ? `/q/page/${params?.currentPage}` : ''
28
- }`}
29
- {...pageMetaProps}
44
+ title={titleTrans}
45
+ metaDescription={metaDescriptionTrans}
46
+ metaRobots={anyFilterActive ? ['noindex'] : metaRobots}
47
+ canonical={isPaginated ? `${canonical}/q/page/${currentPage}` : canonical}
30
48
  />
31
49
  )
32
50
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-category",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "4.2.2",
5
+ "version": "4.3.1",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -19,12 +19,12 @@
19
19
  "type-fest": "^2.12.2"
20
20
  },
21
21
  "dependencies": {
22
- "@graphcommerce/framer-scroller": "2.1.27",
23
- "@graphcommerce/graphql": "3.4.3",
22
+ "@graphcommerce/framer-scroller": "2.1.30",
23
+ "@graphcommerce/graphql": "3.4.5",
24
24
  "@graphcommerce/image": "3.1.7",
25
- "@graphcommerce/magento-product": "4.4.20",
26
- "@graphcommerce/magento-store": "4.2.22",
27
- "@graphcommerce/next-ui": "4.16.0"
25
+ "@graphcommerce/magento-product": "4.4.23",
26
+ "@graphcommerce/magento-store": "4.2.25",
27
+ "@graphcommerce/next-ui": "4.19.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@lingui/react": "^3.13.2",
@@ -12,6 +12,14 @@ query GetCategoryStaticPaths($rootCategory: String!) {
12
12
  children {
13
13
  uid
14
14
  url_path
15
+ children {
16
+ uid
17
+ url_path
18
+ children {
19
+ uid
20
+ url_path
21
+ }
22
+ }
15
23
  }
16
24
  }
17
25
  }