We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4749
    • 623 Posts
    Is there a way to eliminate duplicate title tags in a blog archive section? For example, the blog archive pages all say "Blog | mysite.com" and I would like them to have the month or at least something in the title tag to differentiate the pages, because Google isn’t crawling the whole site because of the duplicate title tags. Is it possible to insert the month/year or some other item to distinguish it on the archive page titles? Thanks.
      The MODx has you...
      Utah Web Design
      • 4749
      • 623 Posts
      Does anyone else have this problem? Duplicate title tags flagged by google in the Webmaster Tools?
        The MODx has you...
        Utah Web Design
        • 18108
        • 24 Posts
        I have exactly the same problem.
        Is there anyone that worked out a solution?

        Thanks in advance.

          Thank you for Modx, and thank you for your help.
          • 7231
          • 4,205 Posts
          Use a snippet to get the information form the archive url. If you look at the url you see that there are a few hooks that you can tie into: wp_month=9&wp_year=2008&wp_day=false&wp_start=0

          return $_GET[’wp_year’] to get the year
          return $_GET[’wp_month’] to get the month number then need to use some additional logic to get the name
          return $_GET[’wp_start’] to get the page number

          Then to make the snippet unobtrusive if you use the same template throughout the site add a simple confirmation if the parameter exists, if not do nothing.

          PS: in the example above the site was using the wordpress config
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don't know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 37099
            • 338 Posts
            It is an old old post, yes, but it just helped me.

            Here is the snippet I used and placed in the header title tag to stop Google warning me about duplicate title tags.
            (and a similar one in the description meta tag)

            I'm using Articles 1.6.8

            <?php
            
            $month = array(
                '01'=>'Jan',
                '02'=>'Feb',
                '03'=>'Mar',
                '04'=>'Apr',
                '05'=>'May',
                '06'=>'Jun',
                '07'=>'Jul',
                '08'=>'Aug',
                '09'=>'Sep',
                '10'=>'Oct',
                '11'=>'Nov',
                '12'=>'Dec',
                );
            
            $o='';
            if($m = $_GET['arc_month']){
                $month = $month[$m];
                $y = $_GET['arc_year']?$_GET['arc_year']:'';
                $o = '- '.$month.' '.$y.' ';
            }    
            else if($_GET['tag']){
                $tag = $_GET['tag']?$_GET['tag']:'';
                $tag = str_replace('+',' ', $tag);
                $o = '- '.$tag.' ';
            }
            else if($_GET['arc_author']){
                $author = $_GET['arc_author']?$_GET['arc_author']:'';
                $author = str_replace('%20',' ', $author);
                $o = '- '.$author.' ';
            }
            
            return $o;


            Mike [ed. note: thingstodo last edited this post 10 years, 8 months ago.]