Skip to content

Commit

Permalink
Merge pull request chesterhow#98 from chesterhow/excerpt-separator
Browse files Browse the repository at this point in the history
allow customisation of homepage excerpt
  • Loading branch information
chesterhow authored Apr 30, 2021
2 parents de5cd20 + 8b7e249 commit 7951a2b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
6 changes: 5 additions & 1 deletion _layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ <h1 class="catalogue-title">{{ post.title }}</h1>
<div class="catalogue-line"></div>

<p>
{{ post.content | strip_html | truncatewords: 30 }}
{% if post.excerpt_separator %}
{{ post.excerpt | strip_html }}
{% else %}
{{ post.content | strip_html | truncatewords: 30 }}
{% endif %}
</p>

</div>
Expand Down
3 changes: 2 additions & 1 deletion _posts/2017-03-16-example-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ layout: post
title: "Example Content"
author: "Chester"
tags: Example
excerpt_separator: <!--more-->
---

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas tincidunt ornare nibh, non elementum augue tempus eget. Pellentesque tempus scelerisque iaculis. Nullam interdum ultricies nibh quis sollicitudin. Donec ornare fermentum facilisis. Ut at sem ac sem imperdiet varius a eget tortor. Nam eu augue eget orci semper maximus in eget augue. Mauris ornare, nisl ut suscipit consectetur, mi quam interdum tellus, at rutrum quam eros ultrices mi.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas tincidunt ornare nibh, non elementum augue tempus eget. Pellentesque tempus scelerisque iaculis.<!--more--> Nullam interdum ultricies nibh quis sollicitudin. Donec ornare fermentum facilisis. Ut at sem ac sem imperdiet varius a eget tortor. Nam eu augue eget orci semper maximus in eget augue. Mauris ornare, nisl ut suscipit consectetur, mi quam interdum tellus, at rutrum quam eros ultrices mi.

# Headers
{% highlight markdown %}
Expand Down
3 changes: 2 additions & 1 deletion _posts/2017-03-29-introducing-tale.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ title: "Introducing Tale"
author: "Chester"
comments: true
tags: Tale
excerpt_separator: <!--more-->
---

Tale is a minimal [Jekyll](https://jekyllrb.com/) theme curated for storytellers. It is designed and developed by [myself](https://github.com/chesterhow/) for a friend who writes short stories.
Tale is a minimal [Jekyll](https://jekyllrb.com/) theme curated for storytellers. It is designed and developed by [myself](https://github.com/chesterhow/) for a friend who writes short stories.<!--more-->

## Tale features
- Compatible with GitHub Pages
Expand Down
19 changes: 19 additions & 0 deletions _posts/2021-04-30-managing-excerpt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
layout: post
title: "Managing Excerpt"
author: "Chester"
tags: Tutorial
excerpt_separator: <!--more-->
---

You can customise the excerpt (the text displayed below each post on the homepage) using the `excerpt-separator`.<!--more--> Here's how you can do so!

### Steps

1. Add `excerpt_separator: <!--more-->` to the frontmatter of your blog post.

2. Insert this `<!--more-->` at where you would like the excerpt to cut off in your blog post.

### Note

This follows [Jekyll's recommended way of managing excerpts](https://jekyllrb.com/docs/posts/#post-excerpts).
2 changes: 1 addition & 1 deletion tale.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |spec|
spec.name = "tale"
spec.version = "0.2.1"
spec.version = "0.2.2"
spec.authors = ["Chester How"]
spec.email = ["[email protected]"]

Expand Down

0 comments on commit 7951a2b

Please sign in to comment.