Canonicalization has long been a basic problem in SEO, especially when using a CMS. Recently search engines implemented the Canonical URL tag, which allows you to specify the preferred canonical URL for a document. See this article on the Canonical URL tag from SEOmoz:
http://www.seomoz.org/blog/canonical-url-tag-the-most-important-advancement-in-seo-practices-since-sitemaps.
Generally, you want the canonical URL to be the same as the "friendly URL" in MODx. To implement this, just put the following code in the head section of your templates:
<link rel="canonical" href="[(site_url)][~[*id*]~]" />
That will automatically set the canonical URL to be the same as the friendly URL for all pages, which is what you want in most cases. If you don’t want that, you can use a template variable to customize the canonical URL in templates for pages where you don’t want this behavior.
Important caveat: it is absolutely crucial that you
don’t use the above code for the homepage, as it may set your canonical url for the homepage to index.html or something like that. This is a very bad idea and can have unpredictable results.
For the homepage only use this code instead:
<link rel="canonical" href="[(site_url)]" />
This simply sets the canonical URL to be the same as the site URL.
Do not use the second version for anything other than the homepage as that will tell Google that you basically want every page to be considered a duplicate version of the homepage, which again will have unpredictable results.
Edit: better yet, use Eol’s code below (requires PHx plugin) to cover both cases with the same code, so you don’t have to use a separate template for the homepage. Thanks Eol!