As you all can see I have switched themes as the old theme was giving me some trouble, and the new one is just so beautiful (isn’t it?)!!!! I came to write this post as a result of trying to make my homepage show only excerpts instead of whole posts. I am sure there’s a plugin for doing that but I could not find it.
I would rather show only excerpts on my home page because I think showing full posts makes the homepage look messy and unorganized. In my old theme I used the
<!–more–> option but I don’t think that’s such a good solution, here’s whys:
- It adds the #more to the URL, which is bad SEO because it creates duplicated content, the regular URL and the one with the #more, which Google does not like.
- Clicking on the #more link takes you to the middle of the post and not the top, where your adds are usually, resulting in your readers missing them.
I took a dive into the code and created the solution I wanted, a homepage with excerpts only!
Here’s how to do it, it’s very easy:
- For starters backup everything! It’s not a risky tweak but as you know, the Murphy law never sleeps…
- Go to the Administrator pages of your blog and then to Presentation tab -> Theme Editor.
- Look for the file called “Main Index Template” and select it for editing .
- Search for the following phrase:<?php the_content(); ?>Sometimes inside the brackets will be a string that says “Continue Reading…” or something similar, each blog has its own way of handling the <!–more–> tag and that string creates a link pointing to the whole post.
- All you have to do is change <?php the_content(); ?> with :<?php the_excerpt(); ?>
- Ok, so now we are showing Excerpts. We just need to add a link for the rest of the post. What we need to add is the following: <br/>
<a href=”<?php the_permalink(); ?>” title=”Read More…” style=”font-size:large”>Read More…</a>The <br/> is so we have a break between the excerpts and the link.
The <?php the_permalink(); ?>” retrieves the post URL into the Href. You can change the style to make the link look like anything you want or just leave it to take the theme’s link style.That’s it! You are all done