Ajax software
Free javascripts
↑
Main Page
Excerpting Article Content
Another potential duplicate content problem occurs when you display the entire article in multiple pages
that enumerate articles — such as the home page, the category pages, and so on. A workaround that we
suggest is to show the full content only on the actual permalink page (the article’s page), and on the home
page for the most recent posts on the home page. All other pages will only show titles and excerpts.
There are many possible implementation solutions. One suggested method is to modify the
index.php
file of your template — this is located in
/wp-content/themes/{your-theme}/
. There, you
have to look after the code that displays the post’s content, which is basically a call to the
the_content()
function, like this:
<div class=”entry”>
<?php the_content(‘Read the rest of this entry »’); ?>
</div>
To display the entire content of posts only on the first page, and on the post’s permalink page, and excerpts
everywhere else, modify the code highlighted earlier like this:
<?php if (is_home() && (!$paged || $paged == 1)
|| is_search() || is_single() || is_page()): ?>
<div class=”entry”>
<?php the_content() ?>
<?php else: ?>
<small>Archived; click post to view. <br />
<b>Excerpt:</b> <?php echo substr(strip_tags($post->post_content), 0, 300); ?>
...
</small>
<?php endif; ?>
This code makes the excerpts 300 characters long, but this feature is easy to customize to your liking.
Making the Blog Your Home Page
If you want the home page to also be the blog, follow the next steps. This will make / output the same as
/blog
, and will redirect all the requests for
/blog
to
/
. This avoids the problem of having two duplicate
home pages,
/
and
/blog/
.
1.
Copy this file to the
seophp
directory as
index.php
:
<?php
/* Short and sweet */
define(‘WP_USE_THEMES’, true);
define(‘WP_IN_ROOTDIR’, true);
require(‘.//blog/wp-blog-header.php’);
?>
309
Chapter 16: : Creating an SE-Friendly Blog
c16.qxd:c16 11:04 309
Ajax software
Free javascripts
→