File.open("#{PAGES_DIR}/sitemap.md", "w") do |f|
f.puts "<!-- WARNING: This page autogenerated. Manual changes will be lost -->"
f.puts "# Sitemap\n\n"
- f.puts "\n\n<p><label>Search:</label><input id=\"search\" type=\"text\"/></p>\n\n"
+ f.puts "<p>\n<label>Search Title:</label><input id=\"search\"/>"
+ f.puts "<label>Search Tags:</label><input id=\"filterTags\" list=\"allTags\"/>"
+ f.puts "<div id=\"activeTags\"></div></p>"
f.puts "<ul id=\"pages\">"
+ tags = []
$db[:pages].values.sort_by{|h| h[:title] }.each do |p|
- f.puts "<li><a href=\"#{web_path(p[:path])}\" tags=\"#{p[:tags].join(" ")}\">#{p[:title]}</a></li>"
+ tags += p[:tags]
+ f.puts "<li><a href=\"#{web_path(p[:path])}\" data-tags=\"#{p[:tags].join(" ")}\">#{p[:title]}</a></li>"
end
f.puts "</ul>"
f.puts "\n\n<p>#{SEARCH_SCRIPT}</p>"
+ f.puts "<p><datalist id =\"allTags\">"
+ tags.sort.uniq.each {|t| f.puts "<option value=\"#{t}\"/>" }
+ f.puts "</datalist></p>"
end
end