- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Separating H1 from menu links
Hi, is it possible for the menu labels for category pages in the main nav to be different than the H1 headers on the page? We'd like to be able to separate them for SEO reasons so we can optimise the H1 without affecting the menu, but our web support company says this isn't possible. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Separating H1 from menu links
Hello @danverghesef0c
In your custom theme, create a new template file that overrides the default navigation rendering. The template file responsible for rendering the main navigation menu is typically located at app/design/frontend/[Vendor_Name]/[Theme_Name]/Magento_Theme/templates/html/topmenu.phtml. Copy this file to the corresponding location in your custom theme.
In the overridden topmenu.phtml file, you can modify the logic that generates the menu labels. You can change how category names are displayed or introduce additional attributes or variables to control the menu labels separately from the H1 headers on the category pages.
200+ Premium Magento 2 Extensions Need help? Hire Magento Developer