magmodules / m2-alternate-hreflang-graph-ql
N/A
Installs: 41
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:magento2-module
pkg:composer/magmodules/m2-alternate-hreflang-graph-ql
Requires
- magmodules/m2-alternate-hreflang: ~2.1
Requires (Dev)
README
This module provides GraphQL support for the Magento 2 Magmodules_AlternateHreflang module (link), allowing you to retrieve hreflang alternate URLs for products, categories, and CMS pages via GraphQL.
Features
- GraphQL endpoint for retrieving alternate hreflang URLs.
- Per-entity resolvers for:
- Products
- Categories
- CMS Pages
 
- Uses Magento StoreView context for correct URL resolution.
Install via Composer
Make sure the base module Magmodules_AlternateHreflang is already installed.
- 
Go to Magento® 2 root folder 
- 
Enter the following commands to install module: composer require magmodules/m2-alternate-hreflang-graph-ql
- 
Enter following commands to enable module: php bin/magento module:enable Magmodules_AlternateHreflangGraphQl php bin/magento setup:upgrade php bin/magento cache:clean
- 
If Magento® is running in production mode, deploy static content with the following command: php bin/magento setup:static-content:deploy
Usage
Products
{
  products(filter: {sku: {eq: "example-sku"}}) {
    items {
      hreflang {
        code
        url
      }
    }
  }
}
Categories
{
  category(id: 3) {
    hreflang {
      code
      url
    }
  }
}
CMS Pages
{
  cmsPage(identifier: "home") {
    title
    hreflang {
      code
      url
    }
  }
}
Configuration
Ensure that the base module is enabled and that hreflang output is configured in the Magento Admin:
Stores > Configuration > Magmodules > Alternate Hreflang
Structure
- CmsAlternateUrls– GraphQL resolver for CMS pages
- CategoryAlternateUrls– GraphQL resolver for categories
- ProductAlternateUrls– GraphQL resolver for products
- BaseAlternateResolver– Shared helper logic for formatting response
Testing
Use tools like GraphiQL or Magento PWA Studio to test queries.
License
See COPYING.txt. All rights reserved © Magmodules.eu.