Summary of Long Posts on Blog Home Page

Is there a way to optionally show the first part of a blog post on my home page rather than the entire post? I saw a reference to using a “” tag, but it doesn’t seem to work.

Thanks!

You can use the <!--more--> tag where you want to split the post

Thanks for the suggestion, @pratik. However, the <!--more--> tag isn’t working. Not sure why.

The <!--more--> tag only causes a post’s .Summary property to be populated, so if you aren’t using a theme or template that takes advantage of that, you have a tiny bit more work to do. This will depend on your theme, but here’s an example of what I did with my customization of Marfa (in layouts/partials/post-item.html):

{{ if .Title }}
  <section class="post-body">
    <header><h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2></header>
    <section class="post-body p-summary">{{ .Summary }}</section>
    <p><em><a href="{{ .Permalink }}">Continue reading →</a></em></p>
  </section>
{{ else }}
  {{ .Content }}
{{ end }}

Like I said, this varies from theme to theme, but basically you’ll want to find the template that lists your posts (usually something like layouts/partials/post-list.html), if that uses a second partial for each individual item, go into that one, and you’ll find a bit rendering the post’s title if it exists. Modify it like the above so that it uses {{ .Summary }} instead of {{ .Content }} and, optionally, use that p-summary class so it’s still proper microformat usage and maybe add some other indicator that it’s a long-form post with more to read (like that “Continue reading” link)