Permalink
Browse files

updated sitemap

  • Loading branch information...
jbrownlee committed Mar 26, 2012
1 parent c64ccd6 commit e2d718fe61452796583f65c9b676cf026c97e2d6
Showing with 3 additions and 15 deletions.
  1. +3 −15 web/generate.rb
View
@@ -1468,15 +1468,12 @@ def add_image(s, host, filename)
add_line(s, "\t\t</image:image>")
end
-def add_url_to_sitemap(s, host, dir, path, images)
+def add_url_to_sitemap(s, host, dir, path)
add_line(s, "\t<url>")
url = host
url = url+"/"+dir if !dir.nil?
url = url+"/"+path if !path.nil?
add_line(s, "\t\t<loc>#{url}</loc>")
- images.each do |image|
- add_image(s, host, image)
- end
add_line(s, "\t</url>")
end
@@ -1500,10 +1497,7 @@ def create_sitemap
# html
host = "http://www.cleveralgorithms.com"
dir = "nature-inspired"
- # root
- add_url_to_sitemap(s, host, nil, nil, ["small_cover.png"])
# all pages
- images = ["very_small_cover.png"]
Dir.entries(OUTPUT_DIR).each do |file|
next if file == "." or file == ".."
if File.directory?(OUTPUT_DIR+"/"+file)
@@ -1512,18 +1506,12 @@ def create_sitemap
if File.extname(subfile) == ".rb"
add_code_url_to_sitemap(s, host, dir, "#{file}/#{subfile}")
elsif File.extname(subfile) == ".html"
- # check for the special case of the visualization chapter
- if file=="advanced" and subfile=="visualizing_algorithms.html"
- others = ["basin1.png", "basin2.png", "ga1.png", "ga2.png", "ga3.png", "pso1.png", "tsp1.png", "tsp2.png", "tsp3.png"]
- add_url_to_sitemap(s, host, dir, "#{file}/#{subfile}", images+others)
- else
- add_url_to_sitemap(s, host, dir, "#{file}/#{subfile}", images)
- end
+ add_url_to_sitemap(s, host, dir, "#{file}/#{subfile}")
end
end
else
next if File.extname(file) != ".html"
- add_url_to_sitemap(s, host, dir, file, images)
+ add_url_to_sitemap(s, host, dir, file)
end
end
add_line(s, "</urlset>")

0 comments on commit e2d718f

Please sign in to comment.