简体   繁体   中英

Jekyll powered site - amount of text shown on homepage

I am setting my blog up using the fantastic Jekyll. Question is my markdown files are being shown in full on the homepage. How do i make them look more like this? So that only a little bit comes up with the title? Thanks.

http://daverupert.com/

EDIT: As of Jekyll 1.0, this is not longer necessary (Answer is outdated).

Jekyll 1.0 exports a post.excerpt variable that contains the first paragraph of a post by default.

/Edit

So, you want to show an excerpt of the post, instead of the full post?

Theres three ways to do that:

  • Render the full post but use CSS to hide everything that is not needed
  • Use filters. You can access post.content , use the truncate filter to truncate it and the markdownify filter to render it.
  • Specify the excerpt in YAML Front Matter and render it using {{post.excerpt | markdownify}} {{post.excerpt | markdownify}} (that is what i do on my blog)

Each of those blocks between horizontal lines are links to the actual blog post. Any time I have a question about how someone did something on their webpage I always view-source.

The source for that page is - view-source:http://daverupert.com/

To find out how to do something in markdown I like this site - http://daringfireball.net/projects/markdown/basics

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM