idxbroker / wordpress-plugin

IMPress for IDX Broker
http://www.idxbroker.com
GNU General Public License v2.0
22 stars 30 forks source link

Better Compatibility with Yoast SEO #46

Open bhubbard opened 8 years ago

bhubbard commented 8 years ago

Currently the plugin creates a CPT called idx_page. When you enable the Yoast SEO Sitemaps, it generates a 404 for this CPT. The plugin should disable check for yoast and disable sitemaps for this custom post type, or update the sitemap to use the idx page urls.

Also it should disable the xml sitemaps for wrappers, and use the yoast settings to noindex all the wrapper pages. Maybe provider better default title and meta descriptions as well.

amcn84 commented 8 years ago

The wrappers are already including: meta name='robots' content='noindex,follow'

This issue seems to rely more on Yoast than IMPress though I would agree we have a large number of users who use Yoast we also have a large number that don't. To eliminate adding dependency to this plugin we should just find an SEO standard to apply to the wrapper pages in general and contact Yoast to add CPT support to remove the features we don't want applied.

bhubbard commented 8 years ago

There really is nothing Yoast should need to do to his plugin. He offers filters to remove or update the SEO settings to any CPT. Here is an example to update the default options for a CPT. The example of code I use here is for any site using a CPT called testimonial:

$yoast_titles = get_option('wpseo_titles');

$yoast_titles['title-ptarchive-testimonial'] = '%%pt_plural%% %%page%% %%sep%% %%sitename%%';
$yoast_titles['metadesc-ptarchive-testimonial'] = 'Check out all these great %%pt_plural%% for %%sitename%%.';

update_option('wpseo_titles', $yoast_titles);

Simply creating a file in IMPress it would check if Yoast SEO is installed and activated. If it is then it could run similar code to above to optimize/set the SEO settings for the idx_page CPT, wrappers, etc.

We should be looking to do this for other popular plugins as well. Here are some gists I have created and have been using similarly.

Jetpack Sharing https://gist.github.com/bhubbard/11b863a43f412e8b68e0

Custom class names for Wrappers https://gist.github.com/bhubbard/3ba8f9cf5bb1b43b5773

Hide AdminBar / Debug Bar/ Comment JS for Wrappers https://gist.github.com/bhubbard/ed5bca848b48804749cf

Print Styles CSS Tag for Wrappers https://gist.github.com/bhubbard/7740935a11ab19f0524c