Magento Content, Meta Tags, and Programmatic SEO

under Magento SEO.

Content and meta tags make up the core of your on site SEO strategy. While links send authority and help determine the relevance of pages, on site content and meta data is the primary source of semantic information that search engines use to understand what your pages are about.

In this post we will review how to set your meta data and content, as well as discuss options for automatically populating some of your content.

How To Change Your Homepage Content In Magento

There are two ways to change your homepage content in Magento. You can edit the page by updating your homepage content, or you can select a different page to load when visitors land on your root domain (i.e. https://www.example.com).

Updating Your Existing Homepage Content

If you want to make a relatively small change to your homepage content, you can do so by editing the existing homepage content fields.

To do this, first you will need to verify which page is acting as your site's homepage. Start by clicking on Stores in the left navigation:

magento shop menu

Now select Configuration under Settings in the Stores menu:

magento settings configuration

Select Web under the General menu:

magento web under general

If necessary, click the arrow next to the Default Pages to expand the section and see the associated fields:

magento expand default pages

Now, under the Default Pages section, look at the CMS Home Page field. Look at the name of the page here. This is the page that will load when visitors first land on your site.

magento check which page is the homepage

After determining which page loads when visitors come to your root domain, it is time to edit the page.

In the left navigation menu, click the Content selection. In the Content pop out menu, click Pages under the Elements section:

magento choose pages under content

Now find the page that you saw earlier was set as your site's homepage, and under the Action column, click the Select link and choose Edit from the drop down menu:

magento select your homepage and edit it

From here, you can set a new title for the page by changing the Page Title field. You can also edit any other element of the page by clicking the expand arrow for the appropriate section (Content, Search Engine Optimization, Page in Websites, Design, or Custom Design Template) and then updating the relevant field. Once you have made your desired changes, click the Save Page button:

magento edit homepage content

Now we need to view the homepage to verify that the changes we made look and function as intended. Click the Back link in the top menu:

magento back out of homepage edit screen

Now find the page that is set as your homepage and, from the Action column, click Select and choose View from the drop down menu:

magento view homepage

You will be taken to a view of your homepage. Verify that your changes are displaying correctly and that the homepage still functions as intended.

How To Change Which Page Loads As Your Site's Homepage

If you want a complete overhaul of your Homepage content, it may be in your best interests to create an entirely new page and set it to appear as the new homepage, instead of updating the existing homepage.

To change which page loads when visitors land on your site's homepage, you will first need to create an alternate homepage. To do this, start by clicking the Content option in the left hand navigation:

magento content menu

Now, in the Elements section of the Content pop out menu, click on the Pages link:

magento select pages from elements under content

Next, click the Add New Page button in the top right corner of the Pages interface:

magento add new page

Now, after making sure the Enable Page option is set to Yes, add a Page Title, then click the expand arrows next to each section of the New Page interface (Content, Search Engine Optimization, Page in Websites, Design, and Custom Design Update) and update every relevant field for the new page with content and design settings. Finally, click the Save Page button in the top right to save your changes:

magento new page content fields and save

Now we will need to take a look at the page to make sure it looks good and functions correctly before we set it as the new homepage. Start by clicking the Back link in the top menu for the newly created page:

back out of magento newly created page

Now, in the Pages interface, find your newly created page. Under the Action column next to your page, click the Select link and click on View in the associated drop down menu:

magento select view for page

You will be taken to a live view of your newly created page as it appears to users. Verify that it looks how you want it to, displays all of your desired content, and that it functions as intended.

Now that you have created the page that you want to act as your new homepage, we will need to change the Magento settings so that the newly created page always loads as the homepage.

Your site's homepage content is generated by the "default page," a CMS page or a piece of content that displays when a user visits your site. To set the homepage, start by selecting Stores from the left navigation menu:

magento stores menu

Next, under the Settings section, click the Configuration option:

magento settings configuration

Now with the General menu selected, click the Web option:

magento web under general

Scroll down to the Default Pages section and, if necessary, click the circled arrow on the right hand side to expand the section and see the associated fields:

magento expand default pages

Now deselect the Use system value check box next to the CMS Home Page drop down menu.

magento cms home page do not use system value Now click the arrow for the drop down menu in the CMS Home Page field and select which page you want to display.

magento cms homepage drop down selection

After making your selection, verify that the correct page is showing in the CMS Home Page field, then click the Save Config button in the top right to save the changes. The page that you selected to act as the homepage will now load any time somebody visits the root of your domain.

magento save default homepage settings

Magento Title Tags

The title tag for a page is the text that search engines use to display a headline and clickable link in the search results.

title tag in google search result

Changing A Magento Page Title

We mentioned how you can update the title tag for your homepage in the section above. The process is essentially the same for any page on your site. Simply navigate to Content > Pages in the left navigation, find the page that you want to update, click Select under the Action column, and click Edit. Then simply update the Page Title field with your desired new title tag:

magento page title

There is one reason you may not want to do it this way, however. Updating the Page Title not only changes your title tag, it also changes the name of the page on the back end:

magento updated page title in back end

This could make it more difficult for you to find and make changes to your site, since the names of your pages on the back end could become unwieldy.

To edit the title tag for the page without changing the name of the page on the back end, from the Edit interface for your desired page, find the Search Engine Optimization section and click the expand arrow if necessary to see the fields.

magento expand SEO section

Now just update the Meta Title field with your desired title tag and click the Save Page button to update the page.

magento change title tag for page

Updating Category Title Tags

To update the title tag for a category page, click Catalog in the left navigation and select Categories:

magento catalog categories in the menu

Now you will need to find your desired category from the category tree on the left side of the page. In the tree, click the "+" button next to any category that has one to see a list of subcategories. Find the category you want to change the title for and click on it:

magento select category from category tree

Now scroll down and find the Search Engine Optimization section and click the expand arrow if necessary to see the fields for the section:

magento category SEO section

Now just update the Meta Title field to include your desired title tag and don't forget to click the Save button to update the title tag for the category:

magento update category title tag

Updating Title Tags For Products

We discussed how to update title tags for product pages in our post about basic Magento 2 SEO settings under the section entitled "Setting Individual Product Page Title Tags, Meta Descriptions, and URLs."

The process is similar to updating the title tag for a page or category. From the left navigation, select Catalog > Products, then identify the product you want to change and click Edit under the Action column. Scroll to the Search Engine Optimization section and update the Meta Title field, and remember to click the Save button when you are done.

Setting Default, Automatically Generated Title Tags In Magento

You can set "default" title tags in Magento that will automatically generate title tags with attributes that you specify. We covered how to do this for products in our post on configuring basic Magento settings in the "Changing Default Settings For Title Tags and Meta Descriptions" section.

To summarize the process:

  • Navigate to Stores > Configuration in the left navigation
  • Select Catalog under the Catalog option
  • Scroll to the Product Fields Auto-Generation section
  • Uncheck the Use system value checkbox for the Mask for Meta Title field if necessary
  • Edit the Mask for Meta Title field with your desired attributes

See Magento's documentation on attribute sets to see what they are and how you can set them up for your products.

Include attributes in your Mask for Meta Title field by including them in double curly brackets, like this:

{{attribute}}

For example, if your attributes were set up properly, you could use a meta title mask like this:

{{name}} by {{brand}} | Example Business Name

To automatically generate title tags like:

Air Max by Nike | Example Business Name

Note that the text outside of the curly brackets is just static text that doesn't change.

The only major pitfall of using this method to generate title tags is that it is a global setting; it can't be set so that different formats are used for different categories. It applies to all products on your site.

Setting Meta Titles Programmatically In Magento 2

You can edit your Magento code to automatically generate or edit title tags on your site to include attributes that will add more specificity and potentially increase your ability to rank for a wider range of long tail search queries. Generally, you should only do this if for some reason you can't accomplish what you are aiming for using default Magento title tags as discussed above.

To implement this safely and effectively, you will need access to a developer with php knowledge.

Have a developer review these StackOverflow recommendations for automatically updating your title tags.

Magento Page Title Separator

You can set your page title separator, which is the character used to separate elements in your titles.

To access this setting, click Stores in the left sidebar and then click Configuration in the Settings section of the menu:

magento stores configuration

Now scroll down and select Catalog from the menu on the left hand side of the Configuration screen:

magento configure catalog

Now select Catalog under the Catalog drop down:

magento catalog under catalog section in configuration screen

Now scroll down to the Search Engine Optimization section, and click the expansion arrow to show the section if necessary. Find the Page Title Separator field, and uncheck the Use system value checkbox if it is checked. The default value is a hyphen "-" but you can delete this and change it to any character you choose. For maximum title space in the search results, you can use a pipe "|" since it is only one pixel wide. Type or paste any character you want here, provided you understand it will be used as the separator in all of your title tags.

Don't forget to click the Save Config button to save your settings for the page title separator.

How To Add Meta Descriptions In Magento

You can set meta descriptions for your pages, categories, and products under the Search Engine Optimization section for each. To find this section, see our guidelines above for setting title tags.

The meta description field is located right next to the title tag field for pages, categories, and products, so there is no need to revisit how to find the field here. (Ignore the Meta Keywords field that you will find listed between the Meta Title field and the Meta Description field.)

The meta description is used to generate the snippet text that appears underneath your title tag in the search results:

meta description in google search results

Remember that meta descriptions do not directly impact your rankings in search results, so the focus of your meta description should be entirely on producing content that will help users understand what they will find if they visit the page and that will entice them to do so.

If you use a keyword or a synonym of a keyword or phrase that the searcher used in their query, it will appear in bold in the snippet, so you may want to include relevant keywords naturally in your meta description to call attention to relevance.

Google will automatically generate a snippet of text if you do not include a meta description. Since Google scans your content to find the portion relevant to the searcher's query and displays it, a meta description isn't always better for your click through rates then simply letting Google automatically generate the snippet. Do not assume that the mere presence of a meta description will always be better for your clicks: verify this with data. Avoid generic non-descriptive meta descriptions, since Google's automatic snippets would likely perform better.

How To Set Default, Automatically Generated Meta Descriptions

You can set default meta descriptions similarly to how you can set default title tags, as discussed above.

Same as above, you would navigate to Stores > Configuration > Catalog > Catalog and then go to the Product Fields Auto-Generation section, which you may need to expand by clicking the expand arrow. Next, you would need to uncheck the Use system value checkbox and edit the field with attributes wrapped in double curly brackets as discussed above for default title tags:

magento set default meta descriptions

Bear in mind that this is a risky move. Automatically generated meta descriptions have a high chance of being less valuable and enticing to users then Google's own automatic snippets are. Only do this if you have a very in depth attribute set available for your entire catalog and you are very sure of what you are doing. Even then, be sure to monitor your search traffic after implementing the change for any losses (or gains) in search traffic as a result of lost clicks.

How To Set Meta Descriptions Programmatically

It is possible to automatically generate meta descriptions in Magento with some code. You will need an experienced developer to do this.

Here is an example of code you might use to change meta descriptions by importing them from a CSV file.

Meta Keywords

You can set meta keywords wherever you can set meta titles and meta descriptions in the sections discussed above. The meta keywords section is, however, defunct in all major search engines. Including meta keywords may still help you in some specialty search engines and other crawlers, but by and large it is a dead standard and there is little reason to go out of your way to include keywords here.

Creating Pages, Categories, and Products

To create a page, navigate to Content > Pages in the left sidebar, then click the Add New Page button. Then make sure to fill out ever field and click the Save Page button.

magento add page

To add a product, navigate to Catalog > Products in the left sidebar, then click Add Product. Again, be sure to populate every relevant field, then click Save to add the product to your store.

magento add product

Adding a category is a little different. Start by navigating to Catalog > Categories in the left navigation:

 

magento catalog categories

Next, select where you want to add a the category in the category tree. Click the Add Root Category option to add a category that isn't listed under any other categories, or click Add Subcategory to create a new category that is a subcategory of the currently selected category.

magento add category

Make sure to populate every field and click the Save button to add the new category.

While you are creating pages, products, and categories, review our guidelines on SEO friendly content in our post about how to write SEO friendly blog posts. Review the section on The Basic Elements Of SEO Friendly Content for our guidelines on how to think about this. Additionally, bear in mind that when it comes to landing pages, product pages, and category pages, your content needs to be very heavy in subheadings and light on paragraphs, taking care to keep the length appropriate to the function of the page.

Importing Products By CSV

If you don't want to create your products one by one in the Magento interface, and would rather upload a CSV containing all of the product fields, there is a built in feature for doing that.

The easiest way to get the format for your CSV right is to start by doing everything manually for the first few products in Magento's interface, the exporting a CSV for those products, and copying the format as you fill out the rest of the spreadsheet.

You will want to make sure that you do the following before importing products:

  • Create attributes and attribute sets that you will be using to describe and set properties for your products.
  • Create categories that your products can easily be categorized into. Your categories should be as mutually exclusive as possible so that products can be placed in only one category.
  • Get your websites, stores, and store views in place.
  • Create a few products, making sure to populate every relevant field.

Now you will need to export the products you just created to a CSV. Start by selecting System from the left sidebar, then click Export under Data Transfer in the pop out menu:

magento system export

From the Export screen, click the drop down arrow for the Entity Type field and select Products:

magento export choose product entity type

A chart of Entity Attributes will appear. These are all of the attributes that you can set for your products. Here you have the option of clicking checkboxes in the Exclude column to remove attributes from your exported CSV. Since you will be using this CSV as the template for uploading new products, you will want to leave all of your attributes in place.

magento export entity attributes

Scroll to the bottom and click the Continue button, and your CSV will start downloading:

magento export products by clicking continue

The next step is straightforward but very time consuming. You will need to open the exported spreadsheet, save it under a new name, and start adding products, making sure to add text or values to every relevant attribute column for every product. Save frequently to avoid losing your work, and remember to save a final time after all of your products have been entered.

After creating your new CSV, it is time to upload your products to Magento.

In the left sidebar of Magento, click System again and click the Import link in the Data Transfer section:

magento system import

From the Import Settings screen, click the Entity Type drop down arrow and select Products:

magento import select product entity type

Several new fields will appear. In the Import Behavior drop down, you have the option of choosing to add every product from the CSV, replace products if their are duplicates, or delete every product that appears in the CSV. Generally you will want to select Replace so that you don't create any product duplicates.

magento import product behavior

There is also an error behavior drop down option, where you can choose to either stop the import if their is an error, or choose for Magento to skip products with errors. This is up to you and what is most convenient for your needs.

An Allowed Errors Count field lets you set how many CSV errors Magento should encounter before stopping the upload entirely. This is only relevant if you chose for Magento to skip errors. The purpose of this is usually to stop uploading if errors are so frequent that it would be a waste of time for Magento to attempt to import the whole CSV.

Make sure that the Field Separator and Multiple Value Separator options are set to match your CSV save format.

Click the Choose File button and select your CSV for import. Make sure that the Images File Directory setting is consistent with how image URLs are referenced in your spreadsheet.magento choose file import

Now click the Check Data button in the top right hand corner of the screen:

magento import check data

If the file is valid, click the Import button in the Validation Results. If there are errors, review the message and update your CSV to fix the errors before moving forward.