Skip to content

Instantly share code, notes, and snippets.

@allizad
Created February 21, 2017 17:23
Show Gist options
  • Save allizad/b8c751237887ae0315e23d9fbad7b84f to your computer and use it in GitHub Desktop.
Save allizad/b8c751237887ae0315e23d9fbad7b84f to your computer and use it in GitHub Desktop.
Jekyll::Hooks.register :posts, :post_render do |post|
# strip html
nokogiri_doc = Nokogiri::HTML(post.output)
puts %(indexing #{post.url})
indexer = indexers[post.site]
indexer << post.data.merge({
id: post.id,
url: post.url,
text: nokogiri_doc.xpath("//article//text()").to_s.gsub(/\s+/, " ")
})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment