Use Post Excerpts Everywhere

By Daniel Scocco

Google and other search engines penalize sites that have duplicated content. That refers not only to two different sites with the same content but also for a single website that has the same content repeated on many different internal pages.

Once you publish a post on your blog this content will be indexed from the single post page. Many templates, however, will also publish that same post on several other pages like category pages, yearly archives, monthly archives, daily archives, search results and so on.

In order to make sure that you are not incurring any penalty for duplicated content you should make all those pages display only post excerpts instead of full posts. You could even display post excerpts on the Homepage, but make sure your readers would be fine with that first (read more about this on the article “Post Excerpts on the Homepage?”).

The first thing you need to do is to check whether your theme is displaying full posts on the wrong places. Check the category pages, run a search to see how results are displayed and check all the archive pages (add a /2007/ to your blog address and see how the posts are displayed).

If your blog is displaying full posts on pages other than the single post page you will need to fix that. WordPress themes usually have the index.php or archive.php file governing how posts are displayed (but could another file). You are looking for something like this:

<?php if (is_category()) { ?>
<div class="page-title">
<h2><?php _e('Archive for'); ?> <?php echo single_cat_title(); ?></h2>
</div>
<?php } elseif (is_search()) { ?>
<div class="page-title">
<h2><?php _e('Search Results'); ?></h2>
</div>
<?php } ?>

Once you find that file you will need to identify where the WordPress Loop starts, which is something like this:

<?php while (have_posts()) : the_post(); ?>

Inside the Loop there is a line making your theme display full posts:

<?php the_content(__('Read the rest of this entry »')); ?>

We could just change the line above with the code for post excerpts, but that would make the exercpts to be displayed everywhere including on the Homepage and on the single post pages.

The solution is to use IF clauses to make sure that only specific pages will display excerpts. Basically you want to create an IF for every page type that is supposed to display excerpts, and at the end you will insert an ELSE to make sure that all other pages will display full posts. Here is how the code will look like:

<?php if (is_search()) { ?>
<?php the_excerpt() ?>
<?php } elseif (is_category()) { ?>
<?php the_excerpt() ?>
<?php } elseif (is_year()) { ?>
<?php the_excerpt() ?>
<?php } elseif (is_month()) { ?>
<?php the_excerpt() ?>
<?php } elseif (is_day()) { ?>
<?php the_excerpt() ?>
<?php } else { ?>
<?php the_content('Read the rest of this entry »'); } ?>



Share

43 Responses to “Use Post Excerpts Everywhere”

  • Lilly

    I dont know how well those work. I’ve always heard better things about displaying full page posts on everything.

  • Daniel

    Lilly, from the SEO point of view full posts everywhere is a disaster.

    Secondly, I also think that excerpts on navigation pages like categories, search results or archives are the best option.

    When you perform a search on Google, would you rather see the full content of every site? The same applies for your internal search results.

    When people browse across categories and archives they are also wanting to scan through many posts to pick one that interests them. With post excerpts that task is accomplished much more efficiently.

  • Bes

    Daniel, what do you think of full excerpts on the home page and the single post page [like this site]?

  • Daniel

    Bes, the optimal from a SEO point of view would be post excerpts even on the Homepage, leaving full posts exclusively on the single post page.

    However many readers prefer full posts on the Homepage, and you need to take them into consideration.

    Recently I came with a really cool solution for this problem, and I will post about it next week.

    Basically you need to add the on all the older posts. That way you will have a full post on the homepage only for a couple of days (provided you post often). Google usually takes 7 days to index new pages, meaning that by the time it indexes your single post page you will already have a tag on that post for the homepage, and there will be no duplicated content at all.

  • Nathania Johnson

    Google also isn’t too fond of duplicate meta tags and title tags. that can be seen as duplicate content, so be sure to use unique ones for each page (which helps you get traffic from “long tail” keywords anyway)

  • menghua

    I would like to know the cool solution you are talking about.. I can see that you show excerpts of the posts after they goes into the 2nd page. 😛

  • Mike

    Why don’t you just use the robots file to tell Google to stay away from all of those category, etc pages and then Google will just index the single posts and all the humans will be happy that they can read full posts everywhere else, too?

  • Maki :: DoshDosh

    Nice tip, Daniel.

    Since you didn’t really mention what is Duplicate Content, I thought I’ll drop a helpful link to the Google Blog for those who are reading.

    “Duplicate content generally refers to substantive blocks of content within or across domains that either completely match other content or are appreciably similar. Most of the time when we see this, it’s unintentional or at least not malicious in origin: forums that generate both regular and stripped-down mobile-targeted pages, store items shown (and — worse yet — linked) via multiple distinct URLs, and so on.”

    Link:
    Defly Dealing with Duplicate Content

  • Patrix

    I am getting an error when I use the above code. Shouldn’t the last curly bracket be closed?

    Also, the last line of the code in my template reads:

    Is it ok?

  • Patrix

    Update…adding the curly bracket in the last line of the code worked. The last line should read:

    <?php the_content('Read the rest of this entry »'); } ?>

  • Patrix

    Sorry for so many comments but how do you handle the /tag/ pages? I tried adding a line by substituting ‘tag’ instead of ‘category’ or ‘month’ but it didn’t work. I use the UTW plugin for my tags.

  • Daniel

    Patrix good questions for the /tag/ pages. When I created one I used the same templated used for the search results so they were displaying excerpts already. You need to tweak the code you used to create the tag pages on the first place.

  • Armen

    This is nifty tip Daniel.

    To be honest, I use the more tag on any post that is over 2 or 3 paragraphs long. I haven’t had any complaints, so I’ll continue to do so.

  • Adam Pieniazek

    Ok I screwed up big time and on purpose posted duplicate content!

    On my blog I’m posting essays and other coursework from college classes I’ve taken and am taking right now. I’m using WordPress and my strategy was to post my essays to “Pages” separate from my posts.

    I then realized that I wasn’t able to tag these essay within WordPress and that any readers I have wouldn’t know that the essays were there (I have a category set up at the top of my site called Education but how many people look at that when reading a blog?)

    So what I started doing is writing posts with analysis and updates and then pasting the entire essays (which were already posted in the “pages section) as regular blog posts.

    Luckily, this blog is fairly new so there isn’t too much duplicate content so far. What should I do about the posts that are already there? Can I use the excerpt function and a redirect so that what’s shown on my main page will link to the static pages?

    I have even more problems, because when I started out I first went with a blog through my school (blogs.umass.edu/apieniaz) and then through wordpress.com (adampieniazek.wordpress.com/) and finally decided to go ahead and register my own domain..so a few of my early posts are triplicated and so are some of the essays I’ve posted!

    Should I delete the other two blogs since I don’t seem to be able to 301 redirect them?

    Sorry for the length of this comment, I’m just really concerned that this is going to heavily affect my search rankings down the line…

  • Daniel

    Adam, quite a unique situation hehe!

    The first thing to keep in mind is your final objective, and that is to have a clean wordpress blog running on your domain with no diplicated content at all.

    My suggestion is to keep your essays as posts on the blog. Delete the pages that are just essays and keep them as posts, that way you can make sure the archives and other pages will just show excerpts of the posts (essays).

    As far as the other blogs go you said it correctly, the best thing would be to place a 301 on old pages pointing to the new ones so you don’t lose any PR or backlinks gained. If you are not able to set the 301 then I would delete the posts. You will not lose the content since you have them on your new blog.

    Let me know if this helps, and drop me an email if you need more help.

  • Bes

    Adam, thanks for the details explanation. You should realize that just because you posted something twice doesn’t mean you did something bad that deserves a beating. The tip offered here is to optimize SEO and maybe SER rankings, and is targeted mostly at Google search engine optimization I think. You should realize one most important thing Adam: most of such things and views are relative, and there is basically nothing wrong or right unless you are aiming at points that search engines hate and you do it for the sole reason to annoy search engines. Even then, if you have great content, you will be ok as long as you don’t try “virtual illegal” things with the sole reason of manipulating search engine rankings when in reality your site does not deserve such a ranking at all. In your case, I think you are completely fine and should relax and continue blogging on.

    Remember, make it fairly easy for your readers and usability and functionality first, and then focus on search engines. Take this very blog, daily blog tips as an example: it uses full posts/text on both the home page and single posts page, and it still gets traffic. Google will follow if targeted people follow.

    Your past essays on other sites are something you shouldn’t worry about; they are older, so Google will get over them and focus more on your newer site, as that is the one that gets refreshed more with newer content compared to the other sites [like your .edu and .wordpress.com sites].

    If you get a decent amount of traffic at the other blogs/sites, simply put a link to the new site telling everyone to start visiting new sites. Otherwise, you can delete them, sure. Either way, it should not hurt you in the short or the long term, as long as people visiting your old blogs know that you now blog at a new blog/site.

    One thing you can do, if you really want, is to edit the other blogs and have small excerpts on them, and having a link on those sites pointing to the same full essays on your new site. It is all up to you. 🙂

  • Mikulla

    I use excerpts on my front page http://www.artrogue.com/ and on my blog section http://www.artrogue.com/blog/ . If I follow correctly, this is not good in google’s eyes. The full content of a post is on an individual article page.

    Maybe I should axe the excerpts on the front page and design it differently?

  • Daniel

    Mikulla, that is right basically your front page and your /blob/ subfolder have the same content. Should not be a big deal though since you have only excerpts and not full posts there.

    You could redesign and front page and include some “about” information there, and leave the posts on the /blog/ folder.

    Keep in mind that what Bes said is right. This is search engine “optimization”. Unless you have huge amounts of duplicated content you should be fine. Google is smart after all.

  • Adam Pieniazek

    Thanks for the tips Daniel and Bes. I was having some trouble getting the redirects to work last night but finally figured out that the built-in text editor on my host wasn’t reading spaces…after I edited the htaccess file with eMacs I was all set…

    And I do understand that I should focus on content (that’s what got visitors to my first blog a few years ago, because I did no SEO at all) but I do like learning about the tech side of running a blog, especially SEO as much of it is based on theory since we can’t get inside the search engine’s thought process!

    Thanks again!

  • Enblogopedia

    Side note, you can optimize your code by using “OR” I think, so the code will look like:

    thanks for the tip 😉

  • Ellen

    Thanks for the tip Daniel. I am now only showing full posts on my front page and individual post page. It is not necessarily optimal SEO but closer than when I was showing full posts everywhere, especially categories where I post to multiple categories — a practice I may stop soon. I’m still learning so all of your tips are great.
    Ellen

  • Jauhari

    I still didn’t understand about it, can someone explain more detail?

  • Jacob Share

    Thanks for the tip, Daniel. There’s an optimized version of the code on the WordPress page for the_excerpt(), you just need to add in the is_search() case:

    http://codex.wordpress.org/Template_Tags/the_excerpt

  • Jacob Share

    You also need to add the is_paged() case (not is_page(), be careful), otherwise visitors can continue clicking Next Page from your homepage and they will see full posts.

  • Bes

    Jauhari, no problem. 🙂 A partial excerpt, or simply a blog excerpt, shows a part of a blog post and a link at the end. That link, when clicked, takes a reader/user to a page where the full blog post can be read.

    A full post, or a full/complete excerpt, on the other hand, shows everything on the same page, so a reader does not have to click any link to read the entire post.

    For example, if you go to http://www.dailyblogtips.com , you can see full posts on the front page. In contrast, if you go to http://www.betanews.com , you will see small/partial news excerpts on the left hand side, where you have to click a link to read the rest of the news.

    Does that make sense? 🙂

  • Martin

    It may just be operator error but when I paste in your code as per what I think are your instructions it generates a huge error in the validator.

    I am not a coding expert but I am either pasting in the wrong place or there is a big error in the code.

    This is the current code:

    I assume your code replaces

    When I do that the validator says “doctype not found.” Remove your code and the error disappears.

  • Lynsey

    It would be perfect, only it has nixed my blockquotes and css styling?!

  • Nicolelay

    The price of hair is not included in the quoted prices below, I will remove all extensions for free when getting them redone at the time of service. I assist with finding and picking out great hair for a great price, in the Milwaukee surrounding area.

    Hair Extensions

    Basic Fusion extensions——————————– (half a head)-$300/(hole head) $500

    Fusion extensions——————– (half a head)-$300/(hole head)-$500

    Sewn In extensions —————– (half a head)- $60/ (hole head)- $100

    Bonded extensions ——————- (half a head)- $55/ (hole head)- $85

    Shrink Links——————————— (half a head)-$300/(hole head)-$500

    Micro Links———————————- (half a head)-$300/(hole head)-$500

    More Services

    First time relaxer, shampoo blow dry style———————– $35

    touch up relaxer, shampoo blow dry style————————- $25

    Perms, shampoo blow dry style—- (short hair)- $65, (medium hair)- $75, (long hair)- $80

    hair styles, shampoo——————– $25 and up

    Scalp treatments, Shampoo———– $17

    Hair cuts, Shampoo———————— $20 and up

    Color——————–$50 and up

    Extras
    Manicure————————— $25 plus deep hand massage

    Pedicures————————— $35 plus deep foot massage

    waxing ————————– (arms)-$20, (half leg)-$30, (hole legs)- $60, (bikini)-$25,
    (chin,face,lip)- $10, underarm-$15

    sugaring (100% better the waxing)———- (arms)-$35, (half legs)-$45, (hole legs)- $75, (bikini)- $40, (chin, face, lip)- $25, underarm-$25

  • Randall Jekings

    Wesley Moore. CBRE. Likes to cheat on his fiance by screwing his little cousins that he meets at family reunions. Class Act. Sacred Heart grad, what do you expect. Christian Brothers. INCEST.

  • Karl Gray

    Thanks for this advise, I have just changed my site so that only my catagories have full posts now and archives and tags just show the title. I also updated the sitemap to exclude the archives as these pages are already in the sitemap via catagories.

    I hadn’t realised that google would be affected by this duplication. Thanks again.

  • Bang Kritikus

    I dont know about php, please give me a tutorial link

Comments are closed.