Posted on September 4th, 2007 by Oleg K
Tags: blogging Code Snippets social bookmarks When I go to blogs like: this or this which generally have short posts/summaries on the home page repeating bookmark buttons can get quite annoying and repetitive.
If you decide to attach something to your posts and want it to only appear on the actual post page, through this code around it…
if ( if ( is_single() || is_page() ){
//INSERT CODE HERE
}
This will only show the code you input on individual blog posts and pages and remove all the clutter from the blog root.
Filed under: Blogging, Code Snippets | Add a Comment »
Posted on September 3rd, 2007 by Oleg K
Tags: blogging Code Snippets duplicate content meta robots seo serp supplimental index wordpress For those who utilize Wordpress as their blogging platform, you may be ranking lower than your supposed to be because you are being penalized for duplicate content. This puts your article pages into the supplement index, and nobody ever sees them.
This doesn’t mean you are stealing information from other sites and posting it on yours. It means you are posting content in several different places at once! How so? Lets see on which pages your post ends up on.
- Root/Index/Homepage - Whatever you want to call it, its on the front page of your blog
- Post page - The article has its own url
- Category(ies) - You article appears on the category page(s) for each category it was published to
- Archives - The post appears in your archives
- Tags - I trust everyone is using UTW. Your post will appear on the multiple tags it was submitted to.
So your content appears on 5-15 pages - not good. Here is the code I use to only index the articles, pages, and homepage.
<?php
if ( is_single() || is_page() ) {
echo ‘<meta name="robots" content="index,follow" />’;
} elseif ( is_home() && $paged < 2 ) {
echo ‘<meta name="robots" content="index,follow" />’;
} else {
echo ‘<meta name="robots" content="noindex,follow" />’;
}
?>
Now lets see what this code does:
if ( is_single
() || is_page
() ) {
echo ‘<meta name="robots" content="index,follow" />’;
If the content shown is a Post or a Page (e.g. About me), the spiders should index it.
} elseif ( is_home
() &&
$paged <
2 ) {
echo ‘<meta name="robots" content="index,follow" />’;
If this isn’t a Post or Page, check if it is the homepage. Also, make sure that this is less than page 2 (so basically, only your homepage). If this is true, spiders should index the page.
} else {
echo ‘<meta name="robots" content="noindex,follow" />’;
}
Otherwise, spiders don’t index the page.
Through that code into the Header template inside the < head> tags and you will be avoiding all of the duplicate content penalties.
Filed under: Code Snippets | 7 Comments »
Posted on August 19th, 2007 by Oleg K
Tags: Code Snippets htaccess index.htm non www pagerank redirect root www People (or you) can link to you to your homepage using four different urls:
http://www.domain.com
http://domain.com
http://www.domain.com/index.html
http://domain.com/index.html
So you are dividing your one page’s pagerank amongst those urls. What you want is for those urls to all be 301 (permanent) redirected to one page, optimally one without the index.html (since later on you may choose to use index.php or other). This can be accomplished with a few simple .htaccess redirects.
First thing you want to do is choose whether you want www.domain.com or domain.com
domain.com >> www.domain.com
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
www.domain.com >> domain.com
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
Replace domain.com with your domain.
Source: enarion.net
Then you want to redirect your index.html/htm/php/any other extension to the folder
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.domain.com/$1 [R=301,L]
Replace index.php with your index.extension and www.domain.com with your domain
Source: Search Masters
Put it into your root folder and viola! You’ve just concentrated 4 pages of pagerank into one!
Filed under: Code Snippets | 1 Comment »