Quick tutorial for Head Meta Pro. When defining your site’s meta tags it is important for SEO and usability to not duplicate any tags. This quick post explains a bit more and provides some ways to ensure that your site is not outputting any duplicate tags.

Why?

Search engines and visitors rely on meta tags, link tags, title tags, and others. They are used to provide useful information about your site, content, author, and many other aspects. So you want to be 100% clear and canonical with any tags that you define for your site. Basically following the DRY principle of not repeating your meta tags. For each tag, you want to output one definitive tag in your source code. Doing so is very important for SEO and site usability.

How?

There are various ways that your site may be adding meta and other tags to your web pages, some examples include:

So if you have more than one of the above adding meta tags, title tags, and so forth, chances are high that your pages suffer from “duplicate tag” syndrome. Especially common to find are duplicate sets of <title> and <meta> description tags. Many themes and plugins add these things automatically.

Check your pages

The best and easiest way to find out if your web pages are outputting duplicate tags, is to simply examine the source code. Using any modern browser, right-click (or context-click) on your web page and select “View Source” or similar. That will open a new tab showing the HTML source for the page. It may look like a lot, and it may be, but no worries. You only need to examine the first section of the web page, the markup included between the opening and closing <head> tag. Here is an example of what you will find, using this site as an example:

<!DOCTYPE html> 
<html lang="en-US">
	<head>
		<meta charset="UTF-8">
		<title>Category: Docs | Plugin Planet</title>
		<meta name="description" content="Plugin Planet archive containing 23 posts..">
		<meta name="robots" content="index,follow">
		.
		.
		.
	</head>
	<body>
	.
	.
	.

According to HTML specification, all meta tags, title tags, and link tags must be located within the <head> tag. So that is the area where you want to check for duplicates. If your source code is more chaotic, an easy way to find duplicates is to Ctrl+F and search the source code. For example, to find all instances of the <title> tag, search the page for “<title>”. Likewise for other tags, some quick searching will reveal whether or not you’ve got any duplicates happening on the page.

Note: If using a cache plugin, you may find different results after clearing emptying the cache. Something to be mindful about when examining your web pages.

Important: If you don’t find any duplicate tags on your pages, congrats! :) But you have to be careful and check more than just one or two pages. This is because WordPress generates different types of page views. For example, there is a home page, single posts, archive pages, and so forth. And depending on the plugin(s) and theme used on your site, each type of view could have a different set of tags in the <head> section. So be careful to check a few pages from each of the following types of page views:

  • Home page
  • Single posts
  • Single pages
  • Any custom post types
  • Any custom taxonomy pages
  • Different types of archive pages (e.g., paged, date-based, category, tag, etc.)
  • Search results pages
  • 404 Not Found pages

And so forth. It sounds like a lot of things to check, but the few minutes it takes will help ensure your tags are correct and ready for search engines (and visitors).

Ways to remove duplicate tags

If you should find (gasp!) duplicate tags on your pages, you’ll want to make some changes to ensure that your tags are canonical, correct, and clear. Here are some steps you can take to eliminate any duplicate tags:

  • If your theme is adding some tags that already exist, ask the theme developer how to remove/disable them
  • If another plugin is adding some tags that already exist, ask the developer how to remove/disable them
  • If Head Meta Pro is adding tags that already exist, they can be removed directly via the plugin settings

Remember: the goal here is to output proper canonical tags to your site. Whether you remove any duplicates via your theme or plugin, is purely a matter of convenience and is your choice.

Nuclear option for duplicate title tags

Easily, the <title> tag is the most commonly duplicated tag in WordPress. That’s because every theme is adding it. Every SEO plugin is adding it. And every meta-tag plugin is adding it. So if you find yourself struggling to remove extra title tags, there is a very powerful way of doing it:

// remove the title tag
remove_action('wp_head', '_wp_render_title_tag', 1);

Add that line via custom code and check the results. From my tests it is very effective at eliminating hard-to-remove title tags. If it works, then you can use Head Meta Pro to add a title tag to your pages.