Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSS feed not respecting Excerpts (more tag) #1146

Open
joelclermont opened this issue Mar 25, 2013 · 14 comments
Open

RSS feed not respecting Excerpts (more tag) #1146

joelclermont opened this issue Mar 25, 2013 · 14 comments

Comments

@joelclermont
Copy link
Contributor

When I use the Excerpt <!-- more --> plugin, I would expect that this also be honored by the RSS feed generator. Only the excerpt should appear in the feed, along with a link to click through and read the whole article.

This appears to be Jekyll behavior, so maybe I should open the issue over there. One cheap trick I had in mind was to have a post-generate task alter the atom.xml file to strip out content after the <!-- more --> tag for each article.

I am open to suggestions and I'm willing to work on this issue if you think it's useful to Octopress (or Jekyll) users in general.

@parkr
Copy link
Collaborator

parkr commented Mar 25, 2013

I wouldn't do post-processing via a generator. I think this makes sense, yeah.

@joelclermont
Copy link
Contributor Author

So if we don't do the post-processing hack, is this an issue I should work upstream in Jekyll? Or if there's a place to override RSS behavior in Octopress, can you point me at the right source files? Thanks again.

@parkr
Copy link
Collaborator

parkr commented Mar 26, 2013

What we might actually do is use the new excerpt attribute of posts in Jekyll 1.0.0.beta2.

Think that'd satisfy these needs?

@joelclermont
Copy link
Contributor Author

Yes, if that functionality applies to the RSS feed, that would suit my needs perfectly.

@parkr
Copy link
Collaborator

parkr commented Mar 26, 2013

Yeah! You can use post.excerpt in your liquid I think!

@joelclermont
Copy link
Contributor Author

That would be great. Anything I can do to help with development? It looks like you are already working on migrating to Jekyll 1.0.

@parkr
Copy link
Collaborator

parkr commented Mar 27, 2013

My Jekyll1.0 code is good to go. I'll merge and you can work off the new 2.1 branch :-) Thanks!

@parkr
Copy link
Collaborator

parkr commented Mar 27, 2013

Just kidding - I already merged #1124 :-)

@joelclermont
Copy link
Contributor Author

Sweet, I'll grab that branch and try the post.excerpt functionality in RSS. I'll report back shortly. Thanks.

@parkr
Copy link
Collaborator

parkr commented Mar 27, 2013

It's all merged into the 2.1 branch so you should be good to go!

@joelclermont
Copy link
Contributor Author

I just pulled the 2.1 branch and tried using post.excerpt instead of post.content inside the source/atom.xml file. When I generate, I get the following error:

Liquid Exception: undefined method `gsub' for nil:NilClass in atom.xml
/vagrant/plugins/octopress_filters.rb:81:in `expand_urls'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/context.rb:58:in `invoke'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/variable.rb:43:in `block in render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/variable.rb:38:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/variable.rb:38:in `inject'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/variable.rb:38:in `render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/block.rb:94:in `block in render_all'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/block.rb:92:in `collect'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/block.rb:92:in `render_all'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/tags/for.rb:116:in `block (2 levels) in render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/tags/for.rb:104:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/tags/for.rb:104:in `each_with_index'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/tags/for.rb:104:in `block in render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/context.rb:91:in `stack'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/tags/for.rb:103:in `render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/block.rb:94:in `block in render_all'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/block.rb:92:in `collect'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/block.rb:92:in `render_all'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/block.rb:82:in `render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/template.rb:124:in `render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/liquid-2.3.0/lib/liquid/template.rb:132:in `render!'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/jekyll-0.12.0/lib/jekyll/convertible.rb:79:in `do_layout'
/vagrant/plugins/post_filters.rb:167:in `do_layout'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/jekyll-0.12.0/lib/jekyll/page.rb:100:in `render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/jekyll-0.12.0/lib/jekyll/site.rb:204:in `block in render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/jekyll-0.12.0/lib/jekyll/site.rb:203:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/jekyll-0.12.0/lib/jekyll/site.rb:203:in `render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/jekyll-0.12.0/lib/jekyll/site.rb:41:in `process'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/jekyll-0.12.0/bin/jekyll:264:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/jekyll:19:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/jekyll:19:in `<main>'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin/ruby_noexec_wrapper:14:in `<main>'
Build Failed

I take this to mean that post.excerpt returned nil which caused the chained filter to fail. Any idea what I'm doing wrong?

@joelclermont
Copy link
Contributor Author

Just stumbled on a low tech solution: post.content | split: '<!-- more -->' | first

It's similar to the post processing hack I had in mind, but it does it within the filter using a very simple split and first filter. This would even work on Octopress 2.0 and doesn't require anything new in Jekyll. Thoughts? post.excerpt would be cleaner, but is there a downside to this?

@parkr
Copy link
Collaborator

parkr commented Apr 2, 2013

Let's do post.excerpt. You can set the excerpt_separator in the configs I think.

@mattheyan
Copy link

Does anyone know the status of this issue, besides the fact that its still open? I see that the atom template still uses 'content'.

A while back I modified the source to use excerpt and everything seemed to work just fine on my blog, the feed is no longer broken due to invalid syntax in post content.

I can fork and submit a pull request if the intention is still to use excerpt. I do wonder though, if an excerpt isn't defined, would it be blank? Is there a way to use the content property instead in that case? I apologize but I definitely have a limited understanding of these technologies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants