Product Dev Back to Ghost

Changing the excerpt to show all content

To display the full content of your posts from within your post list, follow these simple steps below to get started.

Open the index.hbs file of your theme

From within your theme directory, find and open your index.hbs file in your HTML editor. The index.hbs template is the template for the homepage, and gets passed a list of posts which should be displayed (and how they should be displayed).

open index.hbs file

Locate the {{excerpt}} helper

The {{excerpt}} helper outputs content, but strips out all HTML, creating an excerpt of each post. In some cases, you may wan to show the full content, rather than the excerpt. To do this, locate the {{excerpt}} from within your index.hbs file, found in the partials directory.

Note:If using the default theme, Casper, you will need to edit the loop.hbs file, found in the partials directory
 <section class="post-excerpt">
        <p>{{excerpt words="26"}} <a class="read-more" href="{{url}}">&raquo;</a></p>

To show full content, change the helper

To output the full text of the post on your post list, change the {{excerpt words="26"}} helper to the {{content}} helper as shown in the below:

 <section class="post-excerpt">

Create a custom excerpt that includes HTML

If you'd like create a custom excerpt, that includes HTML, you can change {{excerpt}} to {{content words="100"}} which will output 100 words of HTML, with correctly matched tags. So, for example, our code would look like this below:

 <section class="post-excerpt">
        <p>{{content words="100"}} <a class="read-more" href="{{url}}">&raquo;</a></p>

Save your theme

Once you've modified your index.hbs file to accommodate the type of content you want to display, and how it should look, save your theme and upload it to your blog for the changes to take effect immediately.