ecwhim / module-canonical-url-graph-ql
N/A
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:magento2-module
Requires
- ecwhim/module-canonical-urls: >=1.1.0
- magento/module-graph-ql: ^100.3
README
This module provides support of Magento GraphQL for Magento 2 Canonical URL Extension by Ecwhim.
Installation
You can install the module in the following ways:
Install the module using Composer via packagist.com
- Log in to your Magento server as, or switch to, the file system owner.
- Navigate to your Magento project directory.
- Get the latest version of the module:
composer require ecwhim/module-canonical-url-graph-ql
Download package from github.com
- Download the latest version of the package from github.
- Extract the package to the
<magento root directory>/app/code/Ecwhim/CanonicalUrlGraphQl
directory. - Enable the module.
How to use
CategoryInterface attribute
The following table defines the CategoryInterface attribute added by our extension.
ATTRIBUTE | DATA TYPE | DESCRIPTION |
---|---|---|
ecw_canonical_url | String | The absolute canonical URL. |
Example Usage
The following query shows how to get the canonical URL for a category:
Request:
{ categoryList(filters: {ids: {eq: "14"}}){ id name ecw_canonical_url } }
Response:
{ "data": { "categoryList": [ { "id": 14, "name": "Jackets", "ecw_canonical_url": "https://example.com/men/tops-men/jackets-men.html" } ] } }
CmsPage attribute
The following table defines the CmsPage attribute added by our extension.
ATTRIBUTE | DATA TYPE | DESCRIPTION |
---|---|---|
ecw_canonical_url | String | The absolute canonical URL. |
Example Usage
The following query shows how to get the canonical URL for a CMS page:
Request:
{ cmsPage(identifier: "customer-service") { identifier title ecw_canonical_url } }
Response:
{ "data": { "cmsPage": { "identifier": "customer-service", "title": "Customer Service", "ecw_canonical_url": "https://example.com/customer-service" } } }
ProductInterface attribute
The following table defines the ProductInterface attribute added by our extension.
ATTRIBUTE | DATA TYPE | DESCRIPTION |
---|---|---|
ecw_canonical_url | String | The absolute canonical URL. |
Example Usage
The following query shows how to get the canonical URL for a product:
Request:
{ products(filter: { sku: { eq: "24-MB01" } }) { items { name sku ecw_canonical_url } } }
Response:
{ "data": { "products": { "items": [ { "name": "Joust Duffle Bag", "sku": "24-MB01", "ecw_canonical_url": "https://example.com/joust-duffle-bag.html" } ] } } }