[redesign] website routing system
diff --git a/erpnext/templates/includes/products_as_grid.html b/erpnext/templates/includes/products_as_grid.html
index 0a66de2..7a15c1f 100644
--- a/erpnext/templates/includes/products_as_grid.html
+++ b/erpnext/templates/includes/products_as_grid.html
@@ -1,6 +1,6 @@
 {% from "erpnext/templates/includes/macros.html" import product_image_square %}
 
-<a class="product-link" href="{{ (route or page_name)|abs_url }}">
+<a class="product-link" href="{{ route|abs_url }}">
 	<div class="col-sm-4 col-xs-4 product-image-wrapper">
 		<div class="product-image-img">
 		{{ product_image_square(thumbnail or website_image) }}
diff --git a/erpnext/templates/includes/products_as_list.html b/erpnext/templates/includes/products_as_list.html
index a5523a9..b2069e4 100644
--- a/erpnext/templates/includes/products_as_list.html
+++ b/erpnext/templates/includes/products_as_list.html
@@ -1,6 +1,6 @@
 {% from "erpnext/templates/includes/macros.html" import product_image_square %}
 
-<a class="product-link product-list-link" href="{{ (route or page_name)|abs_url }}">
+<a class="product-link product-list-link" href="{{ route|abs_url }}">
 	<div class='row'>
 		<div class='col-xs-3 col-sm-2 product-image-wrapper'>
 			{{ product_image_square(thumbnail or website_image) }}
diff --git a/erpnext/templates/pages/cart.html b/erpnext/templates/pages/cart.html
index 7d8d0ff..35e4989 100644
--- a/erpnext/templates/pages/cart.html
+++ b/erpnext/templates/pages/cart.html
@@ -75,5 +75,5 @@
 	</div>
 </div>
 
-<!-- no-sidebar -->
+
 {% endblock %}
diff --git a/erpnext/templates/pages/home.py b/erpnext/templates/pages/home.py
index 4440f7e..e62687e 100644
--- a/erpnext/templates/pages/home.py
+++ b/erpnext/templates/pages/home.py
@@ -11,9 +11,7 @@
 	homepage = frappe.get_doc('Homepage')
 
 	for item in homepage.products:
-		parent_website_route, page_name = frappe.db.get_value('Item', item.item_code,
-			['parent_website_route', 'page_name'])
-		item.route = '/' + '/'.join(filter(None, [parent_website_route, page_name]))
+		item.route = '/' + frappe.db.get_value('Item', item.item_code, 'route')
 
 	# show atleast 3 products
 	if len(homepage.products) < 3:
diff --git a/erpnext/templates/pages/order.html b/erpnext/templates/pages/order.html
index b548e1f..7129178 100644
--- a/erpnext/templates/pages/order.html
+++ b/erpnext/templates/pages/order.html
@@ -4,13 +4,10 @@
 {% block breadcrumbs %}
 	{% include "templates/includes/breadcrumbs.html" %}
 {% endblock %}
-{% block title %}
-{{ doc.name }}
-{% endblock %}
 
-{% block header %}
-<h1>{{ doc.name }}</h1>
-{% endblock %}
+{% block title %}{{ doc.name }}{% endblock %}
+
+{% block header %}<h1>{{ doc.name }}</h1>{% endblock %}
 
 {% block page_content %}
 
diff --git a/erpnext/templates/pages/partners.html b/erpnext/templates/pages/partners.html
index 132c06b..72d6a64 100644
--- a/erpnext/templates/pages/partners.html
+++ b/erpnext/templates/pages/partners.html
@@ -10,7 +10,7 @@
 	<div class="row">
 		<div class="col-md-3">
 			{% if partner_info.logo -%}
-			<a href="{{ partner_info.page_name }}">
+			<a href="{{ partner_info.route }}">
 				<img itemprop="brand" src="{{ partner_info.logo }}" class="partner-logo"
 					alt="{{ partner_info.partner_name }}" title="{{ partner_info.partner_name }}" />
 			</a>
diff --git a/erpnext/templates/pages/partners.py b/erpnext/templates/pages/partners.py
index 508ea71..6725a3e 100644
--- a/erpnext/templates/pages/partners.py
+++ b/erpnext/templates/pages/partners.py
@@ -11,9 +11,6 @@
 	partners = frappe.db.sql("""select * from `tabSales Partner`
 			where show_in_website=1 order by name asc""", as_dict=True)
 
-	for p in partners:
-		p.route = frappe.get_doc("Sales Partner", p.name).get_route()
-
 	return {
 		"partners": partners,
 		"title": page_title
diff --git a/erpnext/templates/pages/product_search.py b/erpnext/templates/pages/product_search.py
index 465fdd5..8124215 100644
--- a/erpnext/templates/pages/product_search.py
+++ b/erpnext/templates/pages/product_search.py
@@ -14,8 +14,8 @@
 	# limit = 12 because we show 12 items in the grid view
 
 	# base query
-	query = """select name, item_name, item_code, page_name, website_image, thumbnail, item_group,
-			description, web_long_description as website_description, parent_website_route
+	query = """select name, item_name, item_code, route, website_image, thumbnail, item_group,
+			description, web_long_description as website_description
 		from `tabItem`
 		where show_in_website = 1
 			and disabled=0
@@ -38,9 +38,5 @@
 		"today": nowdate()
 	}, as_dict=1)
 
-	for d in data:
-		d.route = ((d.parent_website_route + "/") if d.parent_website_route else "") \
-			+ (d.page_name or "")
-
 	return [get_item_for_list_in_html(r) for r in data]
 
diff --git a/erpnext/templates/pages/rfq.html b/erpnext/templates/pages/rfq.html
index cef93a5..5729e89 100644
--- a/erpnext/templates/pages/rfq.html
+++ b/erpnext/templates/pages/rfq.html
@@ -71,5 +71,5 @@
     </div>
 </div>
 
-<!-- no-sidebar -->
+
 {% endblock %}
diff --git a/erpnext/templates/pages/task_info.html b/erpnext/templates/pages/task_info.html
index c756cd5..1d6574b 100644
--- a/erpnext/templates/pages/task_info.html
+++ b/erpnext/templates/pages/task_info.html
@@ -1,23 +1,23 @@
 {% extends "templates/web.html" %}
 {% block title %} {{ doc.name }} {% endblock %}
 {% block breadcrumbs %}
-<div class="page-breadcrumbs" data-html-block="breadcrumbs">	                    
+<div class="page-breadcrumbs" data-html-block="breadcrumbs">
 	<ul class="breadcrumb">
 		<li>
 			<span class="icon icon-angle-left"></span>
 			<a href="/projects?project={{ doc.project }}">{{ doc.project }}</a>
-		</li>	
+		</li>
 	</ul>
 </div>
 {% endblock %}
 {% block page_content %}
-<div class="row">	
+<div class="row">
 	<div class=" col-sm-8 ">
 		<h1> {{ doc.subject }} </h1>
     </div>
-	
+
 	<div class="col-sm-4">
-		<div class="page-header-actions-block" data-html-block="header-actions">	
+		<div class="page-header-actions-block" data-html-block="header-actions">
 			<button type="submit" class="btn btn-primary btn-sm btn-form-submit">
 	    		Update</button>
 	    		<a href="tasks" class="btn btn-default btn-sm">
@@ -28,38 +28,38 @@
 
 <div class="page-content-block">
 	<form role="form" data-web-form="tasks">
-	
+
 		<input type="hidden" name="web_form" value="tasks">
 		<input type="hidden" name="doctype" value="Task">
 		<input type="hidden" name="name" value="TASK00056">
 
 		<div class="row">
 			<div class="col-sm-12" style="max-width: 500px;">
-				<div class="form-group">		
+				<div class="form-group">
 					<label for="project" class="control-label text-muted small">Project</label>
-						<input type="text" class="form-control" name="project" readonly value= "{{ doc.project }}">		
+						<input type="text" class="form-control" name="project" readonly value= "{{ doc.project }}">
 				</div>
 
 				<div class="form-group">
 					<label for="subject" class="control-label text-muted small">Subject</label>
 					<input type="text" class="form-control" name="subject" readonly value="{{ doc.subject }}">
 				</div>
-								
+
 				<div class="form-group">
 					<label for="description" class="control-label text-muted small">Details</label>
 					<textarea class="form-control" style="height: 200px;" name="description">{{ doc.description }}</textarea>
-				</div>						
-								
+				</div>
+
 				<div class="form-group">
 					<label for="priority" class="control-label text-muted small">Priority</label>
 					<input type="text" class="form-control" name="priority" readonly value="{{ doc.priority }}">
 				</div>
-							
+
 				<div class="form-group">
 					<label for="exp_start_date" class="control-label text-muted small">Expected Start Date</label>
 					<input type="text" class="form-control hasDatepicker" name="exp_start_date" readonly value="{{ doc.exp_start_date }}">
 				</div>
-			
+
 				<div class="form-group">
 					<label for="exp_end_date" class="control-label text-muted small">Expected End Date</label>
 					<input type="text" class="form-control hasDatepicker" name="exp_end_date" readonly value="{{ doc.exp_end_date }}">
@@ -78,7 +78,7 @@
 					</select>
 				</div>
 			</div>
-		</div>		
+		</div>
 	</form>
 </div>
 
@@ -93,7 +93,7 @@
 		<a class="add-comment btn btn-default btn-sm">Add Comment</a>
 		<div style="display: none;" id="comment-form">
 			<p>Add Comment</p>
-			<form>	
+			<form>
 				<fieldset>
 					<textarea class="form-control" name="comment" rows="5" placeholder="Comment"></textarea>
 					<p>
@@ -120,7 +120,7 @@
 								reference_doctype: "Task",
 								reference_name: "TASK00069",
 								comment_type: "Comment",
-								page_name: "tasks",
+								route: "tasks",
 							}
 
 							frappe.call({
@@ -145,5 +145,5 @@
 						})
 					});
 				</script>
-					
+
 {% endblock %}
\ No newline at end of file
diff --git a/erpnext/templates/utils.py b/erpnext/templates/utils.py
index 6f4f4ee..f33e647 100644
--- a/erpnext/templates/utils.py
+++ b/erpnext/templates/utils.py
@@ -9,7 +9,7 @@
 
 @frappe.whitelist(allow_guest=True)
 def send_message(subject="Website Query", message="", sender="", status="Open"):
-	from frappe.templates.pages.contact import send_message as website_send_message
+	from frappe.www.contact import send_message as website_send_message
 
 	website_send_message(subject, message, sender)