How to Create SEO Rules in Magento 2?

When it comes to category or product page SEO, effective meta titles and descriptions play a vital role in the CTR rates. You may try to change or optimize them regularly, but it is extremely time-consuming if you have hundreds or thousands of products. 

That's why SEO rules is a solution you need. Using SEO rules in Magento you can set not only metadata, but H1 tags, descriptions and short descriptions for multiple products and categories in bulk. 

So, today you'll learn how to create SEO rules with the Magento 2 SEO extension to save time and optimize SEO with little effort.

To create SEO rules in Magento 2: 

1. Navigate to Marketing > SEO by Magefan > SEO Rules and press the Add New Rule button. 

2. Enable a rule and specify a Name

3. Set a Priority. The higher the number the later the rule will be processed. 

4. Choose whether to Override Existing Attributes Values.

Note: by default, the rule will be applied only if the attribute is empty or its value equals the category/product name. Set Yes if you want to override existing attribute values.

5. Select the Page Type to create a rule for.

new seo rules in magento

6. Set templates for:

  • H1 Title
  • Description
  • Short Description
  • Meta Title
  • Meta Description
  • Meta Keywords

7. Select the Meta Robots for the pages you create an SEO rule for. 

Note: templates and meta robots options are not required. You can leave some empty or fill out all of them.

8. Set a custom Canonical URL if you need to. 

seo rules magento

9. Choose what Store View to apply the rule to in the Display Settings section.

SEO rules display settings

10. Set the Conditions to specify what products you want to apply your SEO rule to. 

magento seo rules conditions

e.g. we've created an SEO rule for sales products, so we use the Sale product attribute in conditions. 

You can also preview how your meta tags and other templates are displayed, and what products they are applied to. 

preview products seo rules

Although all the rules are applied by cron, you can press the Apply Rules button on the SEO rules grid to apply them immediately.

Then you can also check how new H1 tags and descriptions are applied on the frontend. 

custom h1 tag magento

Once you save one SEO rule you can continue creating them for the rest of the products or categories. There is no limit. You can also create rules for meta robots only, e.g NOINDEX NOFOLLOW tags.