Skip to content

Commit

Permalink
Add support for excerpts on homepage (jekyll#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmaroli authored and DirtyF committed Jan 27, 2018
1 parent 40802b7 commit 3960a68
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,16 @@ To enable Google Anaytics, add the following lines to your Jekyll site:
Google Analytics will only appear in production, i.e., `JEKYLL_ENV=production`

--

### Enabling Excerpts on the Home Page

To display post-excerpts on the Home Page, simply add the following to your `_config.yml`:

```yaml
show_excerpts: true
```

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jekyll/minima. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
Expand Down
3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ description: > # this means to ignore newlines until "baseurl:"
line in _config.yml. It will appear in your document head meta (for
Google search results) and in your feed.xml site description.
# social links
twitter_username: jekyllrb
github_username: jekyll
rss: rss
Expand All @@ -18,6 +19,8 @@ rss: rss
#youtube_username: jekyll
#googleplus_username: +jekyll

show_excerpts: false # set to true to show excerpts on the homepage

# Minima date format
# refer to http://shopify.github.io/liquid/filters/date/ if you want to customize this
minima:
Expand Down
10 changes: 6 additions & 4 deletions _layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ <h2 class="post-list-heading">{{ page.list_title | default: "Posts" }}</h2>
<li>
{% assign date_format = site.minima.date_format | default: "%b %-d, %Y" %}
<span class="post-meta">{{ post.date | date: date_format }}</span>

<h3>
<a class="post-link" href="{{ post.url | relative_url }}">{{ post.title | escape }}</a>
</h3>
{% if site.show_excerpts %}
{{ post.excerpt }}
{% endif %}
</li>
{% endfor %}
</ul>

<p class="rss-subscribe">subscribe <a href="{{ "/feed.xml" | relative_url }}">via RSS</a></p>
</ul>
<p class="rss-subscribe">subscribe <a href="{{ "/feed.xml" | relative_url }}">via RSS</a></p>
{% endif %}

</div>

0 comments on commit 3960a68

Please sign in to comment.