cms updates
diff --git a/.gitignore b/.gitignore
index 0547ba7..0e20728 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,7 +8,6 @@
 public/*.html
 !public/blank.html
 !public/unsupported.html
-!public/login-page.html
 public/js/lib
 public/images/lib
 public/files
diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py
index 37f77a5..919b830 100644
--- a/erpnext/website/doctype/blog/blog.py
+++ b/erpnext/website/doctype/blog/blog.py
@@ -46,8 +46,9 @@
 		import markdown2
 		import os
 		from webnotes.utils import global_date_format, get_fullname
+		from webnotes.model.code import get_obj
 		
-		self.doc.content_html = markdown2.markdown(self.doc.content or '')
+		self.doc.content_html = unicode(markdown2.markdown(self.doc.content or ''))
 		self.doc.full_name = get_fullname(self.doc.owner)
 		self.doc.updated = global_date_format(self.doc.modified)
 		
@@ -56,14 +57,16 @@
 		
 		with open(os.path.join(os.path.dirname(__file__), 'blog_page.js'), 'r') as f:
 			p.script = Template(f.read()).render(doc=self.doc)
-				
+			
+		p.web_page = 'Yes'
 		p.save()
+		get_obj(doc=p).write_cms_page()
 		
 		website.utils.add_guest_access_to_page(p.name)
 		self.doc.page_name = p.name
 		
 		# cleanup
-		for f in ['content_html', 'full_name', 'updated']:
+		for f in ['full_name', 'updated', 'content_html']:
 			if f in self.doc.fields:
 				del self.doc.fields[f]				
 
diff --git a/erpnext/website/doctype/blog/blog_page.js b/erpnext/website/doctype/blog/blog_page.js
index dddc6e0..2dba743 100644
--- a/erpnext/website/doctype/blog/blog_page.js
+++ b/erpnext/website/doctype/blog/blog_page.js
@@ -27,7 +27,7 @@
 		render_row: function(parent, data) {
 			console.log(data);
 			if(data.content && data.content.length==100) data.content += '...';
-			parent.innerHTML = repl('<a href="#!%(name)s">%(title)s</a>\
+			parent.innerHTML = repl('<a href="%(name)s.html">%(title)s</a>\
 				<div class="comment">%(content)s</div><br>', data);
 		},
 		page_length: 5,
diff --git a/erpnext/website/doctype/website_settings/website_settings.py b/erpnext/website/doctype/website_settings/website_settings.py
index 5250213..9693615 100644
--- a/erpnext/website/doctype/website_settings/website_settings.py
+++ b/erpnext/website/doctype/website_settings/website_settings.py
@@ -34,11 +34,25 @@
 	def rewrite_pages(self):
 		"""rewrite all web pages"""
 		import webnotes
+		from webnotes.model.doclist import DocList
 		from webnotes.model.code import get_obj
+		
+		# rewrite all web pages
+		for name in webnotes.conn.sql("""select name from `tabWeb Page` where docstatus=0"""):
+			DocList('Web Page', name[0]).save()
+
+		# rewrite all blog pages
+		for name in webnotes.conn.sql("""select name from `tabBlog` where docstatus=0 
+			and ifnull(published,0)=1"""):
+			DocList('Blog', name[0]).save()
 			
-		for p in webnotes.conn.sql("""select name from tabPage where docstatus=0
-			and web_page = 'Yes'"""):
-			get_obj('Page', p[0]).write_cms_page()
+		from webnotes.cms.make import make_web_core
+		make_web_core()
+		
+		get_obj('Page', 'blog').write_cms_page(force=True)
+		
+		webnotes.msgprint('Rebuilt all blogs and pages')
+		
 		
 	def set_home_page(self):
 
diff --git a/erpnext/website/page/blog/blog.js b/erpnext/website/page/blog/blog.js
index 184424b..356529f 100644
--- a/erpnext/website/page/blog/blog.js
+++ b/erpnext/website/page/blog/blog.js
@@ -33,7 +33,7 @@
 			parent.innerHTML = repl('<h2>%(title)s</h2>\
 				<p><div class="help">By %(first_name)s%(last_name)s, %(date)s</div></p>\
 				<p>%(content)s</p>\
-				<a href="#!%(name)s">Read Full Text</a><br>', data);
+				<a href="%(name)s.html">Read Full Text</a><br>', data);
 		},
 		page_length: 10
 	});
diff --git a/public/js/all-app.js b/public/js/all-app.js
index b9b7933..28d1547 100644
--- a/public/js/all-app.js
+++ b/public/js/all-app.js
@@ -137,9 +137,7 @@
 /*
  *	lib/js/wn/versions.js
  */
-wn.versions={check:function(){if(window.localStorage){if(window._version_number==-1||parseInt(localStorage._version_number)!=parseInt(window._version_number)){var localversion=localStorage._version_number;localStorage.clear();console.log("Cache cleared - version: "+localversion
-+' to '+_version_number)}
-localStorage.setItem('_version_number',window._version_number);}}}
+wn.versions={check:function(){if(window.localStorage){var localversion=localStorage._version_number;localStorage.clear();}}}
 /*
  *	lib/js/wn/assets.js
  */
diff --git a/public/js/all-web.js b/public/js/all-web.js
index d6a1120..4703e5d 100644
--- a/public/js/all-web.js
+++ b/public/js/all-web.js
@@ -24,9 +24,7 @@
 /*
  *	lib/js/wn/versions.js
  */
-wn.versions={check:function(){if(window.localStorage){if(window._version_number==-1||parseInt(localStorage._version_number)!=parseInt(window._version_number)){var localversion=localStorage._version_number;localStorage.clear();console.log("Cache cleared - version: "+localversion
-+' to '+_version_number)}
-localStorage.setItem('_version_number',window._version_number);}}}
+wn.versions={check:function(){if(window.localStorage){var localversion=localStorage._version_number;localStorage.clear();}}}
 /*
  *	lib/js/wn/assets.js
  */
diff --git a/public/js/wn-web.js b/public/js/wn-web.js
index 929e539..cd6552a 100644
--- a/public/js/wn-web.js
+++ b/public/js/wn-web.js
@@ -1,4 +1,3 @@
-window._version_number = "2a070dfb16a80c744b13c7609859086ef91dfd755d70032ee00ee4f6";
 window.home_page = "index";
 // footer signup widget
 // automatically adds it to the .layout-main div of the page
diff --git a/public/rss.xml b/public/rss.xml
index 2aa7ead..3045069 100755
--- a/public/rss.xml
+++ b/public/rss.xml
@@ -21,7 +21,8 @@
 cgitb.enable()
 
 # import libs
-sys.path.append('lib/py')
+sys.path.append('..')
+sys.path.append('../lib/py')
 
 import webnotes
 import webnotes.auth
@@ -29,7 +30,13 @@
 if __name__=='__main__':
 	webnotes.http_request = webnotes.auth.HTTPRequest()
 	from webnotes.cms import feed
-	xml = feed.generate()
-	print 'Content-Type: text/xml'
-	print
-	print xml
\ No newline at end of file
+	try:
+		print 'Content-Type: text/xml'
+		print
+		xml = feed.generate()
+		print xml
+	except Exception, e:
+		print 'Content-Type: text/html'
+		print
+		import webnotes.utils
+		print webnotes.utils.getTraceback()
\ No newline at end of file
diff --git a/public/sitemap.xml b/public/sitemap.xml
index d3e09fd..09ce39a 100755
--- a/public/sitemap.xml
+++ b/public/sitemap.xml
@@ -20,7 +20,8 @@
 cgitb.enable()
 
 # import libs
-sys.path.append('lib/py')
+sys.path.append('..')
+sys.path.append('../lib/py')
 
 import webnotes
 import webnotes.auth