On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
    • @hawproductions | http://mrhaw.com/

      Infograph: MODX Advanced Install in 7 steps:
      http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

      Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
      http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
    • If you prefer it as a snippet (or don’t have PHX installed), here’s the Evolution version. Just create the snippet (call it Canonical) and put [[Canonical]] in the <head> section of your template.
      <?php
      /* Canonical snippet */
      /* Author Bob Ray */
      /* produces an appropriate canonical tag for home and other pages */
      /* put the snippet tag [[Canonical]]  in the <head> section of your template(s) */
      return $modx->documentIdentifier == $modx->config['site_start'] ? '<link rel="canonical" href="[(site_url)]" />' : '<link rel="canonical" href="[(site_url)][~[*id*]~]" />';
      ?>


        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
      • Here is the Revolution version (and a nice example of the differences in getting resource fields and system settings, as well as tag format between Evo and Revo):

        <?php
        /* Canonical snippet */
        /* Author Bob Ray */
        /* produces an appropriate canonical tag for home and other pages */
        /* put the snippet tag [[Canonical]]  in the <head> section of your template(s) */
        return $modx->resource->id == $modx->getOption('site_start') ? '<link rel="canonical" href="[[++site_url]]" />' : '<link rel="canonical" href="[[++site_url]][[~[[*id]]]]" />';
        ?>
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
        • AWESOME!

          Did this make it into the repository yet?
            Patrick | Server Wrangler
            About Me: Website | TweetsMODX Hosting
          • The Revo version should be in the repository as soon as it’s approved. smiley

            (Thank you PackMan! It took me less than 10 minutes.)
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
            • Quote from: rthrash at Jul 30, 2010, 10:19 AM

              The Revo version (and great tips folks!):

              <link rel="canonical" href="[[++site_url]][[*id:isnot=`[[++site_start]]`:then=`[[~[[*id]]]]`]]" />



              Very nice! I personally opt to use the new "scheme" property as outlined in the following thread:

              <link rel="canonical" href="[[~[[*id]]? &scheme=`full`]]" />


              JIRA Feature Request: http://svn.modxcms.com/jira/browse/MODX-1970
              Original thread: http://modxcms.com/forums/index.php?topic=49361.0 cool
                Mike Reid - www.pixelchutes.com
                MODx Ambassador / Contributor
                [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                ________________________________
                Where every pixel matters.
              • anyone else uses the above mentioned
                <link rel="canonical" href="[[~[[*id]]? &scheme=`full`]]" />
                ?
                is that the best practice?
                  Radio sucks!
                • That method should work, granted I make use of MetaX to handle adding that on my sites.
                    Patrick | Server Wrangler
                    About Me: Website | TweetsMODX Hosting
                  • I also use the scheme=`full` method.

                    The advantage of that one is that it doesn’t add double slashes (which I think the [[++site_url]][[~[[~id]]]] does). Plus it looks cleaner.
                      Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                      Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                    • hi everyone

                      i just read through this post about the canonical tag which I found really useful

                      still, i think there is a major and important rule is missing, which is, the proper use of the canonical tag
                      in almost all the posts there are discussions, solutions about how to add or generate the canonical tag automaticaly for each individual page, but the proper use and scope of the canonical tag is missing

                      so, I decided to share with you my case and the main principles of proper use of the canonical tag

                      basically, a canonical tag is needed when a certain page is accessible through more path ie more URL addresses

                      here is an ex:
                      URL1: www.example.com/category01/product03 (main page)
                      URL2: www.example.com/category02/product03 (Symlink)
                      URL3: www.example.com/category03/product03 (Symlink)

                      Since the product03 page is related to more categories, it is accessible through more URL addresses (each of them showing same content)

                      Now we have to decide which one to be the main page, the one to which the other two’s canonical tag would point to.
                      By only implementing your solutions, it would result that each page would have a canonical pointing to ITSELF, which you all know, would not be enough.

                      Here it is what I am using on my site:
                      - first, I have created the main page for my product (let’s suppose URL1)
                      - secondly I created two symlinks of the main page under the other two categories (the Symlinks would load same content as the main page under URL1)
                      - in the third stage I created a TV named canonicalTag with the following settings:
                      Input Type: Tag
                      Default value: <link rel="canonical" href="[[~[[*id]]? &scheme=`full`]]" />
                      Output type: Default
                      

                      - and as the fourth step was to add the call action of this tag in the header section (in my case in the Templates I use)
                      <head profile="http://www.w3.org/profile/html-rdfa-1.1">
                        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
                        <title>[[*pagetitle]] - [[++site_name]]</title>
                        [[*canonicalTag]]
                          <meta name="description" content="[[*description]]" />
                      ..........
                      </head>
                      


                      When all this is done, all I had to do is to change the default canonical value of the Symlinks under Template Variable tab when editing these symlink pages. If not changed, then it would have pointed to themselves. So the manually added canonical tags for these two symlink pages would be:
                      <link rel="canonical" href="http://www.example.com/category01/product03"/>
                      

                      which as you can see points to the main page (URL1)

                      I hope some of you will find my ex useful especially the part of using the canonical tag properly and what its purpose actually is, that of filtering duplicate content and path link value to the main page.

                      regards

                        sherlockseo