Panth HTML Sitemap
mage2kishan/module-html-sitemap
Adds a customer-facing /sitemap page to Magento 2 with a nested category tree, a paginated product grid that scales to 100k+ products, CMS pages, store switcher, and custom links, configurable via 15 admin toggles. Theme-agnostic plain PHP/vanilla JS rendering on Hyva and Luma.
Build Tests
Code Quality
Tested on Magento 2.4.9
Recent Test History
Each release is tested against the latest Magento version at that time.
Top Contributors
View LeaderboardLooking for Contributors
Composer installation fails. Your contribution could help the entire Magento community!
Share This Module's Status
README
Loaded from GitHubPanth HTML Sitemap โ Customer-facing /sitemap Page for Magento 2 (Hyva + Luma)
A complete, theme-agnostic HTML sitemap page for Magento 2 at
/sitemapโ categories as a nested tree, products in a paginated grid that handles 100k+ catalogs, CMS pages, store switcher and custom links. Works identically on Hyva and Luma. Plain PHP + vanilla JS + scoped CSS โ no Alpine / RequireJS / mage-init glue.
Magento's built-in XML sitemap is for Google. This module is for humans โ a readable page your customers land on when they're lost, and an internal-linking surface that spreads PageRank across every category and product on your store.
Preview
Admin Configuration

All 15 toggles at Stores โ Configuration โ Panth Infotech โ HTML Sitemap โ master switch, show categories (with max-depth limit), show products (with sort order, URL structure, pagination), show CMS pages (with exclude list), show store switcher, show custom links, meta title / description, client-side search field, and products-per-page (50โ2000, default 500 โ the sitemap handles 100k+ products via ?p=N pagination).
Frontend โ Hyvรค theme
Native Hyvรค styling โ gradient hero with live counts (categories / products / pages), sticky "On this page" sidebar, and a scoped stylesheet so nothing leaks into the theme's Tailwind bundle.
Frontend โ Luma theme
Identical markup on Luma โ the template is plain PHP + vanilla JS + prefix-scoped CSS (.panth-htmlsitemap), so the same rendering logic produces the same output under Luma's RequireJS layer without any theme-specific overrides.
Need Custom Magento 2 Development?
Kishan Savaliya
Top Rated Plus on Upwork
Panth Infotech Agency
Table of Contents
- Features
- Scales to 100k+ Products
- Compatibility
- Installation
- Admin Configuration
- Hiding a Category
- Troubleshooting
- Support
Features
/sitemapURL โ clean custom-router URL, no/seo/or/htmlsitemap/prefix visible to customers.- Nested category tree โ respects store root, max-depth limit,
is_active, and a per-categoryexclude_from_html_sitemapflag. - Product grid with pagination โ
?p=Npagination for large catalogs, admin-configurable page size (50โ2000, default 500), absolute hard cap of 2,000 pages, efficientCOUNT(DISTINCT)+LIMIT/OFFSETon indexed EAV joins. - Product sort options โ name AโZ, name ZโA, newest, oldest, price ascending, position.
- Short vs category URLs โ choose whether product links are
/product.htmlor/category/product.html. - CMS pages list โ excludes homepage +
no-routeautomatically; admin-configurable extra exclusions (e.g.privacy-policy,cookie-policy). - Store switcher โ optional list of all active stores with their base URLs.
- Custom links โ free-form admin textarea, one link per line (
URL | Label). - Client-side search โ optional search box filters the visible sections in real time, no network calls.
- SEO-friendly meta โ admin-configurable meta title and meta description.
- Theme-agnostic rendering โ plain PHP + inline vanilla JS + prefix-scoped CSS class. No Alpine, no RequireJS, no mage-init.
Scales to 100k+ Products
The product section is designed for real catalogs:
- Pagination: default 500 products per page via
?p=N. Admin-configurable 50โ2000. - Absolute hard cap: 2,000 pages regardless of catalog size โ beyond that an XML sitemap is the right tool.
- Efficient queries: one
COUNT(DISTINCT e.entity_id)for total count (memoised per request), thenLIMIT/OFFSETon the paged SELECT. Noarray_sliceon giant arrays, no full catalog load into memory. - Indexed joins only:
catalog_product_entityรcatalog_product_websiteรcatalog_product_entity_int(visibility + status) โ every filter column is indexed in stock Magento.
Benchmarked render time per page is roughly constant regardless of total catalog size: the sitemap page for product #50,000 renders as fast as the one for product #1.
Compatibility
| Requirement | 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.8 |
| PHP | 8.1, 8.2, 8.3, 8.4 |
| Hyva Theme | 1.0+ (theme-agnostic template) |
| Luma Theme | Native support |
| Panth Core | ^1.0 (installed automatically) |
Installation
composer require mage2kishan/module-html-sitemap
bin/magento module:enable Panth_Core Panth_HtmlSitemap
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
Verify
bin/magento module:status Panth_HtmlSitemap
# Module is enabled
Then visit https://your-store.example/sitemap.
Admin Configuration
Navigate to Stores โ Configuration โ Panth Infotech โ HTML Sitemap. A direct link also appears under the Panth Infotech admin sidebar.
| Setting | Default | Purpose |
|---|---|---|
| Enable HTML Sitemap | Yes | Master switch. No = /sitemap returns 404. |
| Show Categories | Yes | Render the nested category tree. |
| Max Category Depth | 0 | Limit tree depth. 0 = unlimited. |
| Show Products | Yes | Render the paginated product grid. |
| Product Sort Order | Name (A-Z) | Name/newest/oldest/price/position. |
| Product URL Structure | Short | /product.html vs /category/product.html. |
| Products Per Page | 500 | Pagination size. Range 50โ2000. |
| Show CMS Pages | Yes | Include active CMS pages. |
| Show Store Switcher | No | List all active stores. |
| Show Custom Links | No | Render admin-editable link list. |
| Custom Links | (empty) | URL | Label one per line. |
| Meta Title | Site Map | <title> on the sitemap page. |
| Meta Description | (empty) | <meta name="description">. |
| Exclude CMS Pages | (empty) | Comma-separated identifiers to hide. |
| Show Search Field | No | Client-side filter across visible sections. |
Hiding a Category
Every category now has an "Exclude from HTML Sitemap" field in Catalog โ Categories โ {category} โ Search Engine Optimization. Flip it to Yes to hide that category (and its link-children reset to the catalog root, not the hidden category) from the rendered tree. Flush the sitemap's layout cache after changes.
Troubleshooting
/sitemap returns 404
Check the master toggle: Stores โ Configuration โ Panth Infotech โ HTML Sitemap โ Enable HTML Sitemap must be Yes. If the module is installed but the config was never saved, the config.xml default (enabled=1) still applies โ flush config cache.
Products page shows empty after pagination
Two causes: (a) ?p=N is beyond the last page โ clamp client-side to getTotalProductPages(); (b) the visible-product join returns nothing because the store has no products with visibility IN (2,4) and status = 1. Run SELECT COUNT(*) FROM catalog_product_entity to sanity-check the catalog.
DI compile fails after composer require
Ensure Panth_Core, Magento_Store, Magento_Catalog, Magento_Cms and Magento_Eav are all enabled โ they are hard dependencies.
Support
- Issues: github.com/mage2sk/module-html-sitemap/issues
- Agency: Panth Infotech on Upwork
- Direct: kishansavaliya.com โ Get a free quote
This content is fetched directly from the module's GitHub repository. We are not the authors of this content and take no responsibility for its accuracy, completeness, or any consequences arising from its use.