2

I have a blog based on Octopress. It generates an RSS-feed, but that feed contains whole pages (posts) with images included.

How can I "shrink" it, so it would contain only headers of pages (posts)?

Octopress: 2.0
Jekyll: 2.0.3

retif
  • 1,495
  • 1
  • 22
  • 40

1 Answers1

2

In feed.xml, instead of using post.content, you can use post.excerpt.

Two solutions :

1 - Using octopress setup

Add a <!-- more --> in your posts to mark the limit between post.excerpt and post.content. content still contains both.

2 - Using Jekyll default

Remove this line excerpt_separator: <!--more--> from your config file. As the default excerpt separator is "\n\n" (two new lines) excerpt will be created autoamtically.

Alternative solution

Use the truncate filter {{ post.content | truncate: 200 | expand_urls: site.url | cdata_escape }}

You will find more information about excerpt in Jekyll documentation

Community
  • 1
  • 1
David Jacquel
  • 51,670
  • 6
  • 121
  • 147
  • That seems to be exactly what I need, but I don't have `feed.xml`, only several `atom.xml` with the following content: http://pastebin.com/0R8zqJtF. I've changed `post.content` to `post.excerpt` in all of them, but that didn't change anything, unfortinatelly. – retif Jun 09 '15 at 20:59
  • Check in your `_config.yml` file if you have an `excerpt_separator`. See documentation if you need one. – David Jacquel Jun 10 '15 at 09:13
  • Yes, I do have one: `` – retif Jun 10 '15 at 09:16
  • check your jekyll version with `jekyll -v` – David Jacquel Jun 10 '15 at 09:29
  • Sorry for the delay - I was at work and PC was at home. Jekyll version is `2.0.3`, I've just checked. – retif Jun 10 '15 at 16:15
  • 1
    You are amazing, thank you so much. The problem was that in the config: there was `` excerpt-separator (_without_ spaces) and in my posts there was `` excerpt-separator (_with_ spaces). That's why your solution didn't work with my blog in the first time. I changed it and now everyting works just fine. – retif Jun 10 '15 at 17:39