Skip to content

Instantly share code, notes, and snippets.

View aboutwout's full-sized avatar

Wouter Vervloet aboutwout

View GitHub Profile
@ls-lukebowerman
ls-lukebowerman / gist:3677503
Created September 8, 2012 17:24
IndexTank/JSON Sitemap Generator for Middleman
<%
entries = []
pages = sitemap.resources
pages = pages.find_all{|p| p.source_file.match(/\.html/) && !p.directory_index? && p.data.hide_listing != true }
pages.each do |article|
file = File.open(article.source_file,'r')
file_contents = file.read.split('---').last.gsub(/\t|\n/,' ')
content = Nokogiri::HTML(file_contents).xpath("//text()").to_s