Magento meta keywords tag not showing

Magento meta keywords tag not showing

September 28, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento meta keywords tag not showing

Meta Keywords Not Displaying: A Magento Mystery Solved

Are you facing an irritating issue where your carefully crafted meta keywords aren’t showing up on your Magento store’s pages? Despite having the correct code in place, the entire tag vanishes into thin air during page rendering. Don’t worry; we’ll unravel this conundrum together.

The Elusive Meta Keywords Tag

You’ve added a line of code to your head.phtml file, expecting it to display the meta keywords:

<meta name="keywords" content="<?php echo htmlspecialchars($this->getKeywords()) ?>" />

But when you inspect the page source, the entire <meta name="keywords"> tag has disappeared without a trace. It’s as if Magento is playing a game of hide and seek with your important SEO data.

Understanding Magento’s Quirks

Before we dive into the fix, let’s understand why this issue might be occurring. By default, Magento doesn’t display the meta keywords tag because search engines have largely ignored them for many years due to keyword stuffing practices. However, in some cases, the platform may still strip the entire line of code.

The Fix: Unmasking the Keywords

To make your meta keywords visible again, you’ll need to ensure that Magento doesn’t interfere with the tag during page rendering. Here’s a step-by-step guide:

  1. Copy Your Theme - First, create a backup copy of your theme directory in case something goes wrong.
cp -r /path/to/your/theme /path/to/new_copy_of_theme
  1. Override the Head.php File - Magento uses the Head.php file to manage header tags. We’ll override this file with our own version that includes the meta keywords tag.

    Create a new folder named app/design/frontend/Your_Vendor/Your_Theme/Magento_Theme.

    Inside this folder, create a head.phtml file and add the following code:

<?php $_description = $block->getDescription() ?>
<meta name="description" content="<?php echo htmlspecialchars($_description) ?>" />

<?php if ($this->helper('Magento\Seo\Helper\Data')->isRobotsEnabled()): ?>
    <meta name="robots" content="<?php echo $block->escapeHtmlAttr($block->getRobots()) ?>" />
<?php endif; ?>

<?php $_keywords = $block->getKeywords() ?>
<meta name="keywords" content="<?php echo htmlspecialchars($_keywords) ?>" />

<!-- Your existing head tags -->
  1. Clear Cache - After making the changes, clear your Magento cache to ensure the new file is used:
bin/magento cache:clean

A Word of Caution

While this fix should resolve the issue, it’s important to note that search engines don’t typically consider meta keywords as a ranking factor. Focusing on other SEO elements like meta descriptions and structured data markup may provide more significant benefits.

Enhancing Your Magento SEO Strategy

If you’re looking to optimize your site’s SEO further, consider exploring advanced techniques like schema.org markup implementation or customizing the robots.txt file. You can find detailed tutorials on these topics at Laravel Company.

Conclusion

In conclusion, to display your meta keywords in Magento, you need to override the default head.phtml file and include the tag manually. Ensure you have a backup of your theme before making any changes.

Remember that while meta keywords may not carry much weight with search engines, they can still be useful for site visitors and other external services. Always consider the user experience when optimizing your store’s SEO.

Staying up-to-date with Magento best practices is key to maintaining a secure and performant e-commerce platform. For more advanced tips and tricks, don’t forget to check out the Laravel Company blog.

Themes Import/Export SEO Errors

Our network