@graphcommerce/magento-category 4.2.3 → 4.3.0
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 +15 -0
- package/components/CategoryMeta/CategoryMeta.tsx +30 -14
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 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)]:
|
|
12
|
+
- @graphcommerce/magento-product@4.4.22
|
|
13
|
+
- @graphcommerce/graphql@3.4.5
|
|
14
|
+
- @graphcommerce/next-ui@4.18.0
|
|
15
|
+
- @graphcommerce/magento-store@4.2.24
|
|
16
|
+
- @graphcommerce/framer-scroller@2.1.29
|
|
17
|
+
|
|
3
18
|
## 4.2.3
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1,32 +1,48 @@
|
|
|
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
|
-
|
|
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 {
|
|
14
|
+
const { meta_title, meta_description, name, params, current_page } = props
|
|
15
|
+
const {
|
|
16
|
+
title = meta_title ?? name ?? '',
|
|
17
|
+
metaDescription = meta_description ?? undefined,
|
|
18
|
+
metaRobots,
|
|
19
|
+
canonical = params?.url,
|
|
20
|
+
} = props
|
|
21
|
+
|
|
14
22
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
15
23
|
const anyFilterActive = Object.keys(params?.filters ?? {}).length > 0
|
|
24
|
+
const currentPage = params?.currentPage ?? 1
|
|
25
|
+
const isPaginated = currentPage > 1 && !anyFilterActive
|
|
26
|
+
|
|
27
|
+
const titleTrans =
|
|
28
|
+
title && isPaginated
|
|
29
|
+
? i18n._(/* i18n */ '{title} - Page {currentPage}', { title, currentPage })
|
|
30
|
+
: title
|
|
31
|
+
|
|
32
|
+
const metaDescriptionTrans =
|
|
33
|
+
metaDescription && isPaginated
|
|
34
|
+
? i18n._(/* i18n */ '{metaDescription} - Page {currentPage}', {
|
|
35
|
+
metaDescription,
|
|
36
|
+
currentPage,
|
|
37
|
+
})
|
|
38
|
+
: metaDescription
|
|
16
39
|
|
|
17
40
|
return (
|
|
18
41
|
<PageMeta
|
|
19
|
-
title={
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
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}
|
|
42
|
+
title={titleTrans}
|
|
43
|
+
metaDescription={metaDescriptionTrans}
|
|
44
|
+
metaRobots={anyFilterActive ? ['noindex'] : metaRobots}
|
|
45
|
+
canonical={isPaginated ? `/${canonical}/q/page/${currentPage}` : canonical}
|
|
30
46
|
/>
|
|
31
47
|
)
|
|
32
48
|
}
|
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.
|
|
5
|
+
"version": "4.3.0",
|
|
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.
|
|
23
|
-
"@graphcommerce/graphql": "3.4.
|
|
22
|
+
"@graphcommerce/framer-scroller": "2.1.29",
|
|
23
|
+
"@graphcommerce/graphql": "3.4.5",
|
|
24
24
|
"@graphcommerce/image": "3.1.7",
|
|
25
|
-
"@graphcommerce/magento-product": "4.4.
|
|
26
|
-
"@graphcommerce/magento-store": "4.2.
|
|
27
|
-
"@graphcommerce/next-ui": "4.
|
|
25
|
+
"@graphcommerce/magento-product": "4.4.22",
|
|
26
|
+
"@graphcommerce/magento-store": "4.2.24",
|
|
27
|
+
"@graphcommerce/next-ui": "4.18.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@lingui/react": "^3.13.2",
|