How to create post summary
We can make a summary of post, and show it in the home page.
How to only show a part of posts?
Method 1. In index.html file, set \{\{ post.content | strip_html | truncatewords: 50 \}\}
, produces a more consistent excerpt. It gets the first 50 words and strips any formatting.
This method can automatically create a summary of article. However if the article begin with code
or markdown tags
, you will find the article css style can not shown on the home page.
Method 2. In index.html file, using \{\{ post.summary \}\}
to insted of \{\{ post.content \}\}
, produces a summary of post. You need add summary in each post
file, example
Then you will find all articles summary in the home page.
How to create a read more button for a post?
Basically, freshman21 doesn’t support “read more” button.
To create a page link(button) is very easy.
Just add
<p><a href="\{\{ post.url | prepend: site.baseurl \}\}">read more</a></p>
after \{\{post.summary\}\}