🏷️ Magento 2 Meta Tags & URLs – Boost SEO with Better Metadata
In Magento 2, Meta Tags and clean URLs are essential for SEO. They help search engines understand your page content and improve your store’s ranking. Let’s explore how to configure them the right way!
📝 What Are Meta Tags?
Meta tags include:
- Meta Title: The page title shown in search engine results.
- Meta Description: A short summary of the page.
- Meta Keywords (optional): Keywords for SEO (less relevant nowadays).
⚙️ How to Set Meta Tags
🔹 For Products
- Go to Catalog > Products
- Edit a product
- Under Search Engine Optimization tab, add Meta Title, Description
🔹 For Categories
- Go to Catalog > Categories
- Select a category
- In the Search Engine Optimization section, set the metadata
🔹 For CMS Pages
- Go to Content > Pages
- Edit a page and scroll to the Page in Websites section
- Add your Meta Title and Description
// Example: Set meta title for a product programmatically $product = $this->productRepository->getById($productId); $product->setMetaTitle('Super Fast Laptop 2025'); $product->setMetaDescription('Buy the fastest laptop with blazing speed and power.'); $this->productRepository->save($product);
🔗 SEO-Friendly URLs
Magento automatically generates friendly URLs like:
/mens-shoes/running-shoes.html
You can customize them for each product, category, and page.
🔧 Change Product URL
- Go to Catalog > Products
- Edit a product
- Under URL Key, set a short, keyword-rich URL (no .html needed)
🛠 Enable URL Rewrites
- Go to Stores > Configuration > General > Web
- Set Use Web Server Rewrites to Yes
📌 Pro Tips
- Keep URLs short and readable
- Use lowercase letters and hyphens (-)
- Set canonical tags to avoid duplicate content
✅ Summary
Using proper Meta Tags and URLs improves your Magento 2 store’s SEO and helps users find your content more easily. Always update metadata for new products, categories, and pages to stay ahead!