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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top