August 9, 2013
The AWPCP Sitemap XML plugin is the sure-fire way to get your ads indexed by Google, but there's a small issue with Wordpress you have to tweak before it will work correctly.
First, you can get the sitemap plugin here: XML Sitemap for AWPCP
There is an issue with Wordpress that's been around since the beginning about "canonical URLs" where a bunch of URLs might really all point to the same page. Google wants to know what page is the "authority" page for ranking, and so links can be marked like this:
That rel="canonical" business means all other links that appear to go to a similar place (e.g. http://google.com/index.html, http://google.com/index.php, etc) are not the ones that will appear in Google's search results, even though all three will send you to the same "place". Only the http://google.com will be indexed. It's the "canonical" (authority) URL.
AWPCP's classifieds hang off of WP pages. WP pages are all marked with rel="canonical", meaning that any "sub pages" are ignored because they are not the authority link for that page. AWPCP uses WP pages for category browsing and showing ads, so this now blocks the ability of Google to look at your ads even if you install the sitemap XML plugin.
Well, that's wrong for AWPCP. And here's how you fix it. You MUST modify your Wordpress installation as follows (don't worry, it's EASY):
1) Using FTP, SCP or your favorite command line shell, go to your web host.
2) Find the directory <your_site>/wp-includes, where your_site is the default directory of your Wordpress installation.
3) Open the file default-filters.php.
4) Find this line
inside wp-includes/default-filters.php (on WP 3.0.1, it's on line 197, earlier versions say about line 185, just search for "rel_canonical" and you'll find where yours is).
5) Comment it out, like this:
6) Save the file.
That's it, the sitemap will index your ads correctly now. Thanks to roninv for finding this tidbit out and giving me a clue where to look on how to fix it!
EDIT: If you are running Yoast's All In One SEO Plugin, you need to ALSO uncheck "Use Canonical URLs" otherwise, it will override all your hard work here, too!
EDIT2: purplepaula makes this suggestion as well:
Are you using Google Webmaster Tools? If so make sure that the following is unchecked in Google XML Sitemaps (in Basic Options):
You need to generate a robots.txt file within Webmaster Tools and add it to your server. The sitemap will then generate perfectly.
UPDATE, Feb 2, 2013:
Hat tip to holon78 who gave this helpful information:
instead of hacking the WordPress core, i recommend to put the code into the functions.php, located in your theme directory:
to deactivate the built-in canonical, try this:
the yoast seo canonical tag can be removed by using this code:
Most Users Ever Online: 426
Currently Browsing this Page:
Johnny B: 140
NAIN KHAN: 93
Guest Posters: 35
Newest Members:Niklas Andronicus, Faye Stamm, Marisa Behan, Daryl Gerstaecker, Indiana McDonnell, Angel Cribb, Los Cerritos Community Newspaper, Mohamed Trask, Candida Stowers, Mike Moyer
Moderators: awpcp: 7530, AWPCP Support: 5912, Bobbie Devereux: 2
Administrators: wpengine: 0, awpcp: 300