From 8c6e7c655dff6ba91d229904aa919416f4d79482 Mon Sep 17 00:00:00 2001 From: chesterhow Date: Fri, 30 Apr 2021 20:21:06 +0800 Subject: [PATCH 1/3] allow customisation of homepage excerpt --- _layouts/home.html | 6 +++++- _posts/2017-03-16-example-content.md | 3 ++- _posts/2017-03-29-introducing-tale.md | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/_layouts/home.html b/_layouts/home.html index c4609dcc3d..4850fc5681 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -11,7 +11,11 @@

{{ post.title }}

- {{ post.content | strip_html | truncatewords: 30 }} + {% if post.excerpt_separator %} + {{ post.excerpt | strip_html }} + {% else %} + {{ post.content | strip_html | truncatewords: 30 }} + {% endif %}

diff --git a/_posts/2017-03-16-example-content.md b/_posts/2017-03-16-example-content.md index 01e4f050ac..b840c174ed 100644 --- a/_posts/2017-03-16-example-content.md +++ b/_posts/2017-03-16-example-content.md @@ -3,9 +3,10 @@ layout: post title: "Example Content" author: "Chester" tags: Example +excerpt_separator: --- -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. 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 %} diff --git a/_posts/2017-03-29-introducing-tale.md b/_posts/2017-03-29-introducing-tale.md index c234e83b87..a0eadbc527 100644 --- a/_posts/2017-03-29-introducing-tale.md +++ b/_posts/2017-03-29-introducing-tale.md @@ -4,9 +4,10 @@ title: "Introducing Tale" author: "Chester" comments: true tags: Tale +excerpt_separator: --- -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. ## Tale features - Compatible with GitHub Pages From 6ea7ba3ced0b56bd10385fd03f6bbdf1a26392ef Mon Sep 17 00:00:00 2001 From: chesterhow Date: Fri, 30 Apr 2021 20:31:43 +0800 Subject: [PATCH 2/3] add tutorial blog post --- _posts/2021-04-30-managing-excerpt.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 _posts/2021-04-30-managing-excerpt.md diff --git a/_posts/2021-04-30-managing-excerpt.md b/_posts/2021-04-30-managing-excerpt.md new file mode 100644 index 0000000000..70ad61e344 --- /dev/null +++ b/_posts/2021-04-30-managing-excerpt.md @@ -0,0 +1,19 @@ +--- +layout: post +title: "Managing Excerpt" +author: "Chester" +tags: Tutorial +excerpt_separator: +--- + +You can customise the excerpt (the text displayed below each post on the homepage) using the `excerpt-separator`. Here's how you can do so! + +### Steps + +1. Add `excerpt_separator: ` to the frontmatter of your blog post. + +2. Insert this `` 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). From 8b7e24926897d8d1369ce1f451dbb9c7aa905700 Mon Sep 17 00:00:00 2001 From: chesterhow Date: Fri, 30 Apr 2021 20:32:38 +0800 Subject: [PATCH 3/3] update gemspec --- tale.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tale.gemspec b/tale.gemspec index f4cc92bb6a..14d78e5ac3 100644 --- a/tale.gemspec +++ b/tale.gemspec @@ -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 = ["chesterhow@gmail.com"]