WordPress.org

Ready to get started?Download WordPress

Forums

Homepage Snippets (8 posts)

  1. IMC
    Member
    Posted 5 years ago #

    We recently went from a static home page to viewing our 10 most recent posts on our blog homepage. We do not want to have the full post to display on the homepage for fear of duplicate content. How do we display the home page posts as snippets instead of full posts?

  2. stvwlf
    Member
    Posted 5 years ago #

    the simple answer:
    edit index.php in your theme and change the_content() to the_excerpt

    This might cause some other pages to display snippets where you didn't intend. That depends on how the theme you are using is set up.

    If that occurs you will want to make a custom page template to use on the home page to display the excerpts, and leave index.php set to display the full post content.

  3. IMC
    Member
    Posted 5 years ago #

    Thanks for the tip. What is the level of difficulty in creating a custom page template for the home page? I am not advanced with modifying the templates.

    Additional: After modifying the template, I like the layout. I see [...] at the end of all the posts now. How do I turn that into a link or add a "read more" link to the end?

    Also, after implementing this, I lost all of the images, even if you click the actual article. Is there a way to fix this and include images in the snippets and/or the actual article other then creating a custom template page for the homepage?

  4. IMC
    Member
    Posted 5 years ago #


  5. stvwlf
    Member
    Posted 5 years ago #

    Hi

    You won't get images when you use the_excerpt.

    Here's an article that explains other excerpt options:
    http://lorelle.wordpress.com/2006/07/21/writing-with-post-excerpts-and-feed-excerpts-in-mind/

    I see [...] at the end of all the posts now. How do I turn that into a link or add a "read more" link to the end?
    You have to modify the template - home page would be index.php - and add the text (and a link that takes them to the full article).

    Example

    <p>Click here to <a href="<?php the_permalink(); ?>">read the full post</a></p>

    Check what you are using for URL's on your images - you want to use full paths, not relative paths - http://mydomain.com/blog/wp-content/uploads/whatever/myphoto.jpg

    That path must be set up for where YOUR image files are located in your installation.

    the_excerpt strips out images.

    you can check these plugins too - I've not worked with them
    http://wordpress.org/extend/plugins/advanced-excerpt/faq/

    http://wordpress.org/extend/plugins/excerpt-editor/

    You probably don't need to make a custom home page template

  6. IMC
    Member
    Posted 5 years ago #

    I've downloaded and installed Advanced Excerpt but still cannot figure out if the plugin can use images in the excerpt. I've tried looking on the author's site and found nothing. Am I trying to do something that is not possible? Sometimes I need an image to display as a teaser to lead people to the site.

    Thanks for the help in advance.

  7. IMC
    Member
    Posted 5 years ago #

    Hello... any help here???

  8. IMC
    Member
    Posted 5 years ago #

    For anyone following this, I have figured out how to use the snippets. It's very simple and I completely overlooked the answer.

    When you are creating a new post, after you finish, click the "HTML" tab. After you determine where you would like your post to cut off, simple add <!--more--> after the last word you would like to see in the snippet. This will add a "Read the rest of this entry" link at the end of the snippet and link to the full post. Just make sure you add this tag under the HTML tab in your content.

    This will help resolve duplicate content on your blog.

Topic Closed

This topic has been closed to new replies.

About this Topic