mage2kishan / module-crosslinks
Automatic internal crosslinks for Magento 2 (Hyva + Luma). Converts configured keywords in product, category, and CMS content into anchor links to boost internal linking and SEO. Extracted from Panth_AdvancedSEO for independent installation.
Package info
github.com/mage2sk/module-crosslinks
Type:magento2-module
pkg:composer/mage2kishan/module-crosslinks
Requires
- php: ~8.1.0||~8.2.0||~8.3.0||~8.4.0
- mage2kishan/module-core: ^1.0
- magento/framework: ^103.0
- magento/module-backend: ^102.0
- magento/module-catalog: ^104.0
- magento/module-cms: ^104.0
- magento/module-store: ^101.0
- magento/module-ui: ^101.0
README
Magento 2 Auto Internal Linking Extension: Crosslinks for Hyva + Luma
Automatically turn keywords in your store content into internal links. Panth Crosslinks scans product descriptions, category descriptions, and CMS pages at render time and injects anchor tags for every keyword you define. Set up rules once in the admin grid and they apply across your entire catalog without touching a single description by hand.
Product page: kishansavaliya.com/magento-2-crosslinks.html
Quick Answer
What is Panth Crosslinks? It is a Magento 2 internal linking extension that reads an admin-managed list of keyword-to-URL rules and automatically injects anchor tags into product, category, and CMS content at render time.
What does it add to my store?
- An admin grid where you define keyword rules with a target URL, a product SKU, or a category ID.
- Automatic link injection into product descriptions, short descriptions, category descriptions, CMS pages, and CMS blocks.
- Per-keyword and per-page limits so pages never get over-linked.
- Time-based activation so you can schedule campaign links with start and end dates.
- Safe rendering that skips headings, existing anchors, buttons, scripts, and styles.
Which themes are supported? Both Hyva and Luma. The replacement happens on the PHP side before the template renders, so the theme makes no difference.
What does it need? Magento 2.4.4 to 2.4.8, PHP 8.1 to 8.4, and the free mage2kishan/module-core package.
🚀 Need Custom Magento 2 Development?
Get a free quote for your project in 24 hours for custom modules, Hyva themes, performance work, M1 to M2 migrations, and Adobe Commerce Cloud.
Visit our website: kishansavaliya.com | Get a quote: kishansavaliya.com/get-quote
Table of Contents
- Who Is It For
- Key Features
- Screenshots
- Compatibility
- Installation
- Configuration
- Managing Crosslink Rules
- How It Works
- FAQ
- Support
- About Panth Infotech
- Quick Links
Who Is It For
- SEO-focused merchants who want consistent internal linking across a large catalog without editing every description manually.
- Content teams that launch new category pages or promotions and need keyword links to go live the same day across hundreds of products.
- Stores with scheduled campaigns that need crosslinks to turn on at a specific date and turn off automatically when the sale ends.
- Hyva and Luma stores that want the same internal linking behavior regardless of which frontend theme they run.
- Developers who need a clean, rule-based internal linking tool that fits inside an existing SEO workflow without breaking the rest of the page.
Key Features
Keyword-to-Anchor Injection
- Case-insensitive, whole-word matching so
bagdoes not matchbaggageorhandbag. - Three reference types: direct URL, product by SKU (resolved via
url_rewrite), or category by category ID (resolved viaurl_rewrite). - Applies to product descriptions, short descriptions, category descriptions, CMS pages, and CMS blocks through Magento's output helper and CMS filter plugins.
- Rendered anchors carry
class="panth-crosslink"so you can style them from your theme CSS without touching other links.
Rule Management in the Admin Grid
- Full CRUD admin grid at Admin → Panth Infotech → Crosslinks with filter, sort, and pagination.
- Mass actions: enable, disable, or delete multiple rules at once.
- Store-view scope: set
store_id = 0to apply a rule everywhere, or pick a specific store view. - Priority field: higher-priority rules are processed first when the per-page link budget runs out.
Limits and Safety
- Per-keyword
Max Replacementscaps how many times a single rule fires on one page. - Per-page
Max Links per Pageis a global ceiling set in configuration. - Excluded tags (h1 to h6, a, button, script, style by default) are never rewritten, configurable per store.
- Dangerous URL schemes (
javascript:,data:,vbscript:,file:) are rejected at render time even if they reach the database.
Time-Based Activation
Active FromandActive Todate fields on every rule, stored asDATETIMEso schedules work past 2038.- Store-level toggle to enable or ignore time gating, so you can run always-on rules and scheduled rules on the same store.
Hyva + Luma Ready
- Works on both themes because replacement runs on the PHP side through Magento output plugins and CMS filter decorators.
- No frontend JavaScript required. The anchor tags are in the HTML before the browser sees the page.
- Ships a small CSS file (
crosslinks.css) with a teal underline preset that you can override in your theme.
Built to Last
- Clean constructor dependency injection throughout, no ObjectManager calls.
- Full Page Cache friendly: replacement runs inside Magento's content rendering pipeline, not in a cache-busting AJAX call.
- Translation ready: every admin label uses Magento's
__()function. - Extracted from Panth_AdvancedSEO for standalone installation; existing rules in
panth_seo_crosslinkfrom the advanced SEO module continue to work without a data migration.
Screenshots
Live walkthrough
End-to-end admin flow: configure the module, add a keyword rule, save, and see the crosslink appear on the storefront.
Admin
Global configuration - toggle the module, cap links per page, set excluded tags, and enable time-based activation.
Rules grid - list every crosslink rule with keyword, reference type, target URL, placement toggles, store scope, schedule, and priority.
Edit form - Category reference (all stores) - link the keyword "bag" to Category by ID 4. Max Replacements = 2, Priority = 100.
Edit form - Scheduled Custom URL - Flash Sale rule active only between 01 Jan 2027 and 31 Dec 2027.
Storefront - Hyva
Product description (Affirm Water Bottle) - backpack links to Endeavor Daytrip Backpack SKU, bag links to Bags category.
Product description (Zing Jump Rope) - fitness links to Fitness Equipment category.
Category description (Bags) - backpack, training, gear, bag, watch rendered in the category intro.
CMS page (/crosslink-test) - links for every seeded keyword in a single paragraph.
Storefront - Luma
Product description (Affirm Water Bottle) - same rules render identically on Luma's default template.
Product description (Zing Jump Rope) - fitness links to Fitness Equipment category.
Category description (Bags) - backpack, training, gear, bag, watch rendered on the category intro.
CMS page (/crosslink-test) - rules rendered via the CMS FilterProvider plugin on both block and page filters.
Compatibility
| Requirement | Versions Supported |
|---|---|
| Magento Open Source | 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8 |
| Adobe Commerce | 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8 |
| Adobe Commerce Cloud | 2.4.4 to 2.4.8 |
| PHP | 8.1.x, 8.2.x, 8.3.x, 8.4.x |
| Hyva Theme | 1.0+ (fully compatible) |
| Luma Theme | Native support |
| Required Dependency | mage2kishan/module-core (free) |
Installation
Composer Installation (Recommended)
composer require mage2kishan/module-crosslinks bin/magento module:enable Panth_Core Panth_Crosslinks bin/magento setup:upgrade bin/magento setup:di:compile bin/magento setup:static-content:deploy -f bin/magento cache:flush
Manual Installation via ZIP
- Download the latest release from Packagist or from the product page.
- Extract it to
app/code/Panth/Crosslinks/in your Magento install. - Make sure
Panth_Coreis installed too (required dependency). - Run the commands above starting from
bin/magento module:enable.
Verify Installation
bin/magento module:status Panth_Crosslinks
# Expected: Module is enabled
After install, open:
Admin → Panth Infotech → Crosslinks
Configuration
Go to Stores → Configuration → Panth Infotech → Crosslinks, or use the Crosslinks Configuration link in the admin sidebar.
| Setting | Group | Default | Description |
|---|---|---|---|
| Enable Auto Cross-Links | Auto Cross-Links | Yes | Master toggle. When No, no keyword rules are injected anywhere, regardless of individual rule state. |
| Max Links per Page | Auto Cross-Links | 5 | Global ceiling on the total number of anchor tags injected into any single rendered page. Prevents over-optimization. |
| Excluded Tags (comma-separated) | Auto Cross-Links | h1,h2,h3,h4,h5,h6,a,button,script,style | HTML tags whose contents are never rewritten. Keywords inside these tags are left as plain text. |
| Enable Time-Based Activation | Auto Cross-Links | No | When Yes, each rule's Active From and Active To date fields gate whether the rule fires. When No, all active rules are always eligible. |
Each setting resolves at store-view scope, so you can have different link budgets and excluded tag lists per store.
Managing Crosslink Rules
Open Admin → Panth Infotech → Crosslinks to reach the rules grid.
Rule Fields
| Field | Description |
|---|---|
| Keyword | Case-insensitive phrase the engine searches for. Whole-word boundaries only. |
| Reference Type | Custom URL uses the URL field directly. Product by SKU resolves the product's storefront path. Category by ID resolves the category's storefront path. |
| URL | Used only when Reference Type is Custom URL. Accepts relative paths (/category/shoes.html) or absolute URLs. |
| Reference Value | The SKU (for Product by SKU) or the category ID (for Category by ID). |
| URL Title | Optional title attribute on the rendered anchor. |
| Store View | 0 applies to all stores. A non-zero value restricts the rule to that store view. |
| Active | Per-row enable/disable toggle. |
| Active From / Active To | Start and end dates, evaluated only when the store-level time-activation setting is on. |
| Apply to Product / Category / CMS | Three independent toggles. A rule fires only in the surfaces that are checked. |
| Max Replacements | Per-rule cap. After N matches on the current page, this rule stops. |
| Nofollow | Adds rel="nofollow" to the rendered anchor. |
| Priority | Higher values are processed first when the per-page link budget is tight. |
Mass Actions
Select rows and choose Enable, Disable, or Delete from the grid mass-action menu to update many rules at once.
How It Works
- Admin grid stores rules in the
panth_seo_crosslinktable with keyword, reference type, limits, store scope, and schedule. - On each page render, the
CatalogOutputPluginfires after Magento renders product and category attribute values and passes the HTML to theReplacementService. - The
CmsFilterPluginwraps the CMS template filter so the replacement engine runs after Magento has processed widgets and directives. - The
ReplacementServicesplits the incoming markup into text nodes and tag nodes. Keywords are matched only inside text nodes, never inside tag attributes or content that falls inside excluded tags. - Rules are applied in priority order. Each match consumes one slot from the rule's
Max Replacementscounter and one slot from the globalMax Links per Pagecounter. - After all rules run, placeholder tokens are replaced with real anchor tags. This two-pass approach stops later rules from re-entering links built by earlier rules.
- The rendered anchor carries
class="panth-crosslink"and optionallyrel="nofollow"and atitleattribute, as configured.
FAQ
Does this work on Hyva themes?
Yes. The replacement runs on the PHP side through Magento output plugins, so there is no theme-specific JavaScript involved. The same code produces the same result on Hyva and Luma.
Will keywords match inside headings or existing links?
No. Headings (h1 to h6), anchor tags, buttons, scripts, and styles are in the excluded tags list by default. You can add or remove tags in configuration.
Can I link to a product or category without knowing the URL?
Yes. Set Reference Type to Product by SKU and enter the SKU, or set it to Category by ID and enter the category ID. The module looks up the current storefront URL via Magento's url_rewrite table on every render.
Does it work with scheduled promotions?
Yes. Enable Time-Based Activation in configuration, then set Active From and Active To dates on each rule. Dates are stored as DATETIME, so schedules work past 2038.
Will it slow down my pages?
The replacement engine splits HTML into segments and applies regex substitution in memory. For typical page content the overhead is not noticeable. If you notice a difference, lower Max Links per Page or reduce the number of active rules.
Can I stop the module from linking the same keyword more than once per page?
Yes. Set Max Replacements on the rule to 1. That rule will inject at most one anchor per rendered page.
Does it break Full Page Cache?
No. Replacement runs inside Magento's rendering pipeline, so the output is the same on every request. FPC caches the fully rendered HTML including the injected anchors.
Does it work with multi-store setups?
Yes. Settings resolve at store-view scope. You can have different link budgets, excluded tag lists, and rule sets per store. Rules with store_id = 0 apply globally; non-zero rules are scoped to a specific store view.
Does Panth Crosslinks need Panth Core?
Yes. mage2kishan/module-core is a free, required dependency that Composer installs for you automatically.
Support
| Channel | Contact |
|---|---|
| Product Page | kishansavaliya.com/magento-2-crosslinks.html |
| kishansavaliyakb@gmail.com | |
| Website | kishansavaliya.com |
| +91 84012 70422 | |
| GitHub Issues | github.com/mage2sk/module-crosslinks/issues |
| Upwork (Top Rated Plus) | Hire Kishan Savaliya |
| Upwork Agency | Panth Infotech |
Response time: 1-2 business days.
💼 Need Custom Magento Development?
Looking for custom Magento module development, Hyva theme work, store migrations, or performance tuning? Get a free quote in 24 hours:
About Panth Infotech
Built and maintained by Kishan Savaliya (kishansavaliya.com), a Top Rated Plus Magento developer on Upwork with 10+ years of eCommerce experience.
Panth Infotech is a Magento 2 development agency that builds high quality, security focused extensions and themes for both Hyva and Luma storefronts. The extension suite covers SEO, performance, checkout, product presentation, customer engagement, and store management, with each module built to MEQP standards and tested across Magento 2.4.4 to 2.4.8.
Browse the full extension catalog on our Magento extensions page or on Packagist.
Quick Links
| Resource | Link |
|---|---|
| 🛒 Product Page | magento-2-crosslinks.html |
| 📦 Packagist | mage2kishan/module-crosslinks |
| 🐙 GitHub | mage2sk/module-crosslinks |
| 🌐 Website | kishansavaliya.com |
| 💬 Free Quote | kishansavaliya.com/get-quote |
| 👨💻 Upwork (Top Rated Plus) | Hire Kishan Savaliya |
| 🏢 Upwork Agency | Panth Infotech |
| kishansavaliyakb@gmail.com | |
| +91 84012 70422 |
Ready to build consistent internal links across your entire catalog?
SEO Keywords: magento 2 internal linking, magento 2 crosslinks, magento 2 crosslinks extension, magento 2 crosslinks module, magento auto internal links, magento keyword links, magento 2 anchor injection, magento seo internal links, hyva internal linking, luma internal linking, magento 2 contextual links, magento 2 automatic crosslinks, magento 2 keyword to url, magento 2 link injection, magento 2 seo links, magento 2 cms crosslinks, magento 2 product description links, magento 2 category description links, magento 2 scheduled links, magento 2 nofollow links, magento 2 internal seo extension, magento 2.4.8 internal linking, php 8.4 magento crosslinks, mage2kishan crosslinks, panth crosslinks, panth infotech, hire magento developer, top rated plus upwork, kishan savaliya magento, custom magento development












