27 Feb 2016

This article will take less than 1 minute to read.
5 Comments

It is nice to use post.excerpt instead of post.content on your Jekyll home page, but then users can’t see if there is more to read until they open the whole post.

To add Read more link, you can use this simple snippet.

{% if post.excerpt != post.content %}
    <a href="{{ site.baseurl }}{{ post.url }}">Read more</a>
{% endif %}
Category
Jekyll

Comments (5)

Brendan
05 Jun 2019, 11:24 PM

Hey this is cool

Andrew
29 Dec 2019, 07:49 AM

Hi,

New to blogging with Jekyll, so glad I found the your site. Very professional.

The code, when added to my index.html, basically works. I have still done something wrong. I start with a test excerpt in the front matter, and get the intended hyperlink that takes me to the whole post.

But the markdown post doesn’t get formatted properly. I have a couple of animated gif files at the top, which appear in the wrong size. The text is now the wrong size also, and scroll bars appear for the overall over-scaled post. It seems like the theme design for the basic theme (Lanyon), is stripped out and replaced by basic HTML . Any help appreciated.

Cheers,

Andrew.

Stanko
29 Dec 2019, 09:35 AM

Hey Andrew,

Not sure what you have done wrong. Are you missing Front Matter section in your post? This tells Jekyll which layout to use, and without it, it will render unstyled HTML.

Cheers!

Simone
28 Dec 2020, 06:02 PM

Great stuff, works like a charm — thanks for sharing!

Stanko
28 Dec 2020, 06:31 PM

Glad it helped and that people are still finding these old posts of mine :) Cheers!