0

The theme I am using does most all the SEO stuff that I want it to with the exception of tweaking the titles on a post by post basis, and the ability for me to write my own meta descriptions for each post. I just looked at my source code and I noticed lots of duplicate code. I'm wondering what the best practice is to correct this. (I'm assuming having duplicate code like that can cause some problems...)

I could just disalbe the yoast plug in, but if I did I'm assuming I would loose all of the custom meta descriptions and titles I have wrote for almost 200 posts. I'm assuming I need to turn off in the yoast plug in whatever functions are being duplicated in my theme. The problem is I'm not sure what functions the theme duplicates, and how to turn them off. (I'm pretty new to all of this, and still learning.)

Has anyone else ran into this? Can you please help me figure what the best way to proceed? Thanks.

I've included some of source code of my home page. (It wouldn't let me post the entire source code)

 <!DOCTYPE html>
    <html dir="ltr" lang="en-US">
        <head>  
                    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            <meta name="description" content="A Blog About Noah, Down Syndrome, His Family and the Videos, Pictures and Facts that Tell Their Story" />
            <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
            <link rel="profile" href="http://gmpg.org/xfn/11" />
            <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://noahsdad.com/feed/" />
            <link rel="pingback" href="http://noahsdad.com/xmlrpc.php" />
            <link rel="canonical" href="http://noahsdad.com" />
            <!--[if IE 8]>
            <link rel="stylesheet" type="text/css" media="all" href="http://noahsdad.com/wp-content/themes/Standard/css/ie8.css" />
            <![endif]-->  
            <!--[if IE 7]>
            <link rel="stylesheet" type="text/css" media="all" href="http://noahsdad.com/wp-content/themes/Standard/css/ie7.css" />
            <![endif]-->  
                <script type="text/javascript">
        // <![CDATA[
            var disqus_shortname = 'noahsdad';
            (function () {
                var nodes = document.getElementsByTagName('span');
                for (var i = 0, url; i < nodes.length; i++) {
                    if (nodes[i].className.indexOf('dsq-postid') != -1) {
                        nodes[i].parentNode.setAttribute('data-disqus-identifier', nodes[i].getAttribute('rel'));
                        url = nodes[i].parentNode.href.split('#', 1);
                        if (url.length == 1) { url = url[0]; }
                        else { url = url[1]; }
                        nodes[i].parentNode.href = url + '#disqus_thread';
                    }
                }
                var s = document.createElement('script'); s.async = true;
                s.type = 'text/javascript';
                            s.src = 'http' + '://' + 'disqus.com/forums/' + disqus_shortname + '/count.js';
                (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
            }());
        //]]>
        </script>

    <!-- This site is optimized with the Yoast WordPress SEO plugin v1.1.5 - http://yoast.com/wordpress/seo/ -->
    <meta name="description" content="A blog about Noah, Down Syndrome, his Family, and the videos, pictures, and facts that tell our story. I hope yo check out our daily 1 minute videos!"/>
    <meta name="keywords" content="down syndrome, facts, videos, pictures, images, down syndrom, information"/>
    <link rel="canonical" href="http://noahsdad.com/" />
    <link rel="next" href="http://noahsdad.com/page/2/" />
    <meta name="google-site-verification" content="bM3Xh77FD51oIfTMMStTA5VF0dLwInO00n_Z787BXdo" />
    <meta name="msvalidate.01" content="FE5E9CAC2BE0360684519396A5E187CF" />
    <!-- / Yoast WordPress SEO plugin. -->

    <link rel="alternate" type="application/rss+xml" title="Noah&#039;s Dad &raquo; Feed" href="http://noahsdad.com/feed/" />
    <link rel="alternate" type="application/rss+xml" title="Noah&#039;s Dad &raquo; Comments Feed" href="http://noahsdad.com/comments/feed/" />
        <style type="text/css">
        .wp-pagenavi{margin-left:auto !important; margin-right:auto; !important}
        </style>
      <link rel='stylesheet' id='wpinstagram-css'  href='http://noahsdad.com/wp-content/plugins/instagram-for-wordpress/wpinstagram.css?ver=0.3.2' type='text/css' media='all' />

2 Answers 2

1

As far as my usage with Yoast's WordPress SEO plugin goes, I thought always assumed the plugin simply replaced any existing code with what it generates for that same purpose.

If you are using the plugin and don't want to disable it, then simply go into your header.php file and delete/comment-out any meta tags that are generating the duplicate code. However, some of those are automatically generated by WordPress, so add this code block to your functions.php file and you should be good to go. In theory.

// cleans up unnecessary header links
remove_action('wp_head', 'feeds_links_extra', 3);
remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'parent_post_rel_link', 10, 0);
remove_action('wp_head', 'start_post_rel_link', 10, 0);
remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
remove_action('wp_head', 'wp_generator');

The above code along with the following code from my header.php file cleans everything up nicely:

<!DOCTYPE html>
<!--[if lt IE 7]><html class="ie ie6 no-js" <?php language_attributes(); ?>><![endif]-->
<!--[if IE 7]><html class="ie ie7 no-js" <?php language_attributes(); ?>><![endif]-->
<!--[if IE 8]><html class="ie ie8 no-js" <?php language_attributes(); ?>><![endif]-->
<!--[if IE 9]><html class="ie ie9 no-js" <?php language_attributes(); ?>><![endif]-->
<!--[if gt IE9]><html class="no-js" <?php language_attributes(); ?>><![endif]-->
<head>

    <title><?php wp_title(''); ?></title>

    <meta charset="<?php bloginfo('charset'); ?>" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

    <?php wp_head(); // all scripts should be loaded in functions.php ?>

</head>
<body <?php body_class(); ?>>

    <header>
        <h1><a href="<?php echo get_option('home'); ?>"><?php bloginfo('name'); ?></a></h1>
    </header>

I hope this helps you out, please let me know if you have further questions! :) Also, on a side note, if you (or anyone else) needs a good source for how to properly setup the WordPress SEO plugin, check out this excellent tutorial.

4
  • Thanks so much for your help. I really appreciate it. The only reason I'm keeping the plug in is to keep all of the old title and custom meta descriptions I've used it to write...as well as write new ones. Is there a way to do this without the plug in?
    – Rick Smith
    Mar 1, 2012 at 20:32
  • I'm sure there is some other way, but I highly recommend keeping the plugin. In my opinion, it's the best. It does a tremendous amount of the leg work by itself, and if you set the templates, you don't have to do ANY work if you don't want to. I'd make sure to check out the link I posted. They go through all the features and explain how to utilize them for all their awesomeness.
    – cmegown
    Mar 1, 2012 at 21:07
  • cool, I will. By the way I'm using a child theme. Do you know if I can enter that code into a child theme so when they update their theme it won't override the code?
    – Rick Smith
    Mar 1, 2012 at 21:13
  • A child theme could technically have every aspect of a parent theme, essentially making it an entirely separate theme. If you want to put the above code into a child theme, do it - it won't hurt a thing and would indeed prevent your work from being overwritten.
    – cmegown
    Mar 2, 2012 at 19:40
0

If you want to use that plugin, just remove duplicate functionality from the theme. Or disable the plugin if you want to use the theme's "SEO" optimization things - it's that simple.

From my point of view, both are completely useless. Quality content will improve your site rank, not adding some random meta tags, most of which Google ignores anyway (like "keywords").

But if you really want to help searching engines, you can start organizing your HTML following the schema.org markup.

6
  • I didn't say anything about "key words." But title tags, and meta descriptions are very important. In addition canonical urls, site maps, and some of the other functions are equally important. I agree that good quality content is key, but there are other things that have to be done well, as well in order for people to find your good quality content. :)
    – Rick Smith
    Mar 1, 2012 at 18:16
  • Also, you didn't really answer my question; how do I know which functions the theme is duplicating, and how do I turn those features off in the plug in?
    – Rick Smith
    Mar 1, 2012 at 18:17
  • wel from the code you posted above - only the description and the canonical tag are being duplicated. The description is the real problem (I'm guessing GWT warns you about this). You are using a commercial theme, so I can't tell you how to disable descriptions in the theme. Mar 1, 2012 at 18:29
  • Actually google hasn't warned me about it, but it also seems that rss, and some other info is being duplicated.
    – Rick Smith
    Mar 1, 2012 at 18:33
  • Then probably Google doesn't care about duplicate tags on the same page. Duplicate descriptions across different pages however - that I can assure you it does Mar 1, 2012 at 19:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.