Question

Is there any easy way to keep images from showing up in Middleman blog post summaries?

I have images that appear near the beginning of my post, and therefore appear in the summary. I would like for the summary to only include text.

I see that you can write your own summary generator, but I haven't learned Ruby yet. I'm hoping that this is a built-in option that I haven't come across yet.

Était-ce utile?

La solution

Try including gem 'nokogiri' into your Gemfile, running bundle install and starting your Middleman server with bundle exec middleman server.

Then you should be able to do Nokogiri::HTML(article.summary).text to retrieve text from summaries.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top