-
-
Hello everyone,
A little trick that might help many of you with your SEO.
If you are customizing your meta title and description (and you really should) you might want to use some dynamic information to save time and help you out.First of all, before telling you about this trick, a few reminders about metas and what I think is the best way to use them.
You should always keep in mind that metas are directed to people on the web, they must be readable, attractive and relevant.
Also remember that they will appear on Google search results. People will take less than a second to decide if they will click on your link or not, do not try to make it a clickbait, just try to explain, in very few words what is your product or your service. You will get more clicks and a better bounce rate.You should customize them as much as you can:
This is actually the most common mistake I see and one of the reason of this post.
I know, customizing metas for each product is very time consuming, more over if you work on websites with thousands of products.My advice:
Make a global meta title and description as many dynamic values as possible, with custom attributes. This will do most of the work for you. You will just have to check the result while creating new products and make minor adjustments.Keep it simple:
This point is almost like the 1st advice but need to be said twice 🙂
Many site decide to put the name of their site in the meta title, or their shop catchphrase, I think this is a mistake.
If someone is searching in Google “iPhone X 16GB”
They will click on a meta showing :
“iPhone X 16GB from $200, 1 year warranty”
Not on :
“Best iPhones at the best price from superphonesite.site”Now, many plugin that helps you manage SEO have features to create dynamic meta titles and meta descriptions for your products, including Smartcrawler pro. But if you need to add a custom attribute, it is not possible. Adding a custom woo commerce attribute like color, size, model number can be very useful to customize your meta automatically and save you a lot of time.
Here is how you can add custom attribute in your meta for WPMU Dev’s Smartcrawl plugin
1st thing, You will have to create a small mu-plugin. Open up your favorite HTML editor and save tis code as custom-meta-attribute.php.
Now head over to your WordPress installation and upload this little mu-plugin to wp-content/mu-plugins folder. Once you done that it is instantly activated by the system and no more action is needed on your side. If the “mu-plugins” folder doesn’t exist then create it in the wp-content folder.
WordPress MU-plugin code:
<?php /** * Plugin Name: Add custom META attribute WPMU DEV Smartcrawl * Plugin URI: https://shorturl.gg * Description: Enables custom META attribute * Author: Simple URL Shortner * License: GNU General Public License v3 or later * License URI: http://www.gnu.org/licenses/gpl-3.0.html */ // Basic security, prevents file from being loaded directly. defined( 'ABSPATH' ) or die( 'Cheatin’ uh?' ); // Begin mu-plugin code add_filter( 'wds-macro-variable_replacement', function( $replacement, $macro ){ if( strpos( $macro, '%%ct_') === 0 && is_single() ){ global $post; $pattern = "/(%%ct_[a-z_]+%%)/"; $matches = array(); $replacements = array(); $match_result = preg_match_all( $pattern, $macro, $matches, PREG_PATTERN_ORDER ); if ( ! empty( $match_result ) ) { $placeholders = array_shift( $matches ); foreach ( array_unique( $placeholders ) as $placeholder ) { $taxonomy_name = str_replace( array( "%%ct_", '%%' ), '', $placeholder ); $taxonomy = get_taxonomy( $taxonomy_name ); if ( empty( $taxonomy ) ) { continue; } $replacement = wp_strip_all_tags( get_the_term_list( $post->ID, $taxonomy_name, '', ', ' ) ); break; } } } return $replacement; }, 10, 2);
-
Awesome. Thank you OP.
Follow the crowd and you be just another cheep.
-
You must be logged in to reply to this topic.