-
For most personal blogs, it seems that the All in One SEO Pack plug-in is not an efficient SEO solution (see this article for details). In software development, there is a saying: "Convention is better than configuration". Numerous configuration options come at the cost of reduced performance. As a general-purpose plug-in, All in One SEO Pack must take care of all aspects, and Many time-consuming functions are not very necessary for small personal blogs.
By default, WordPress is already "Search Engine Friendly". Only original and meaningful article content can help personal blogs get better SEO evaluation. The following optimization methods are just the icing on the cake. And compared to the All in One SEO Pack plug-in, the performance improvement provided by the method provided in this article may not be so "obvious" on some low-traffic blogs. But for someone like me who is obsessed with code, adding a bunch of plug-ins that I didn’t write on my blog always makes me feel uncomfortable.
What features do we need from the All in One SEO Pack plugin?
Before looking for alternatives to the All in One SEO Pack plugin, you need to understand this first. The following functions are the most valuable and cannot be provided by WordPress by default:
1. The title of the blog should be written in the form of content | blog name;
2. Add sufficient meta description to the head part;
3. Let search engines not index archived pages. Archived pages contain duplicate content, which will lower your blog’s score.
4. Add unique keywords to each article and blog homepage;
Solutions to these problems will be given below. If you don’t know much about the PHP language, just follow the instructions and copy and paste them into your WordPress template.
Fix blog title
Find the header.php file in the template folder, open it and modify the title tag:
<title><?php wp_title(' | ', true, 'right'); ?><?php bloginfo('name'); ?></title>
/**Or just write down the name of your blog, you won’t change your blog name from time to time**/
<title><?php wp_title(' | ', true, 'right'); ?>Cogipard Playground</title>
Add sufficient meta description
Or modify the header.php file and add the following content to the head tag as appropriate:
/**For the descriptive content of the blog, you can write it down like me, or you can use the wordpress subtitle (obtained with bloginfo("description"))**/
<meta name="description" content="A personal online home, portfolio and journal." />
/**Blogger’s name**/
<meta name="author" content="dotswing" />
/**Copyright information**/
<meta name="copyright" content="Cogipard Playground" />
Archive pages are not indexed
Modify the header.php file and add: following the above meta tag:
<?php if (is_single() || is_page() || is_home() ) : ?>
<meta name="robots" content="index,follow" />
<?php else : ?>
<meta name="robots" content="noindex,follow" />
<?php endif; ?>
In this way, search engines will not index these duplicate content for archived pages.
Keywords for personalized output page articles
In the functions.php file under the template folder, add the following functions:
function keywords() {
$keywords = '';
if( is_single() || is_page() ){
$terms = get_the_terms( get_the_ID(), 'post_tag' );
if ( is_wp_error( $terms ) )
return $terms;
if ( empty( $terms ) )
return false;
foreach ( $terms as $term ) {
$keywords .= $term->name;
$keywords .= ', ';
}
}
else {
$tags = get_tags('orderby=count&order=DESC');
foreach ($tags as $tag){
$keywords .= $tag->name;
$keywords .= ', ';
}
}
$keywords = substr($keywords, 0, strlen($keywords)-2);
echo $keywords;
}
The function of this function is that if the visitor is browsing a separate article page, the tag corresponding to the article will be extracted as a keyword; if it is other pages, all the tags of the blog will be output as keywords. Keywords are separated by commas.
Call this function in header.php:
<meta name="keywords" content="<?php keywords();?>" />
The code in functions.php can be used directly in the template page. WordPress has already done the include operation for us, so there is no need to write include_once('functions.php'); ourselves.
Article source: http://cogipard.info/articles/all-in-one-seo-pack-alternative