diff --git a/_includes/nav.html b/_includes/nav.html
index e41f79e..8f0b089 100644
--- a/_includes/nav.html
+++ b/_includes/nav.html
@@ -1,51 +1,55 @@
-
+
+ {%- assign ordered_pages_list = site.html_pages | where_exp:"item", "item.nav_order != nil" -%}
+ {%- assign unordered_pages_list = site.html_pages | where_exp:"item", "item.nav_order == nil" -%}
+ {%- if site.nav_sort == 'case_insensitive' -%}
+ {%- assign sorted_ordered_pages_list = ordered_pages_list | sort_natural:"nav_order" -%}
+ {%- assign sorted_unordered_pages_list = unordered_pages_list | sort_natural:"title" -%}
+ {%- else -%}
+ {%- assign sorted_ordered_pages_list = ordered_pages_list | sort:"nav_order" -%}
+ {%- assign sorted_unordered_pages_list = unordered_pages_list | sort:"title" -%}
+ {%- endif -%}
+ {%- assign pages_list = sorted_ordered_pages_list | concat: sorted_unordered_pages_list -%}
+ {%- for node in pages_list -%}
+ {%- unless node.nav_exclude -%}
+ {%- if node.parent == nil and node.title -%}
+ -
+ {%- if page.parent == node.title or page.grand_parent == node.title -%}
+ {%- assign first_level_url = node.url | relative_url -%}
+ {%- endif -%}
+ {%- if node.has_children -%}
+
+ {%- endif -%}
+ {{ node.title }}
+ {%- if node.has_children -%}
+ {%- assign children_list = pages_list | where: "parent", node.title -%}
+
+ {%- for child in children_list -%}
+ {%- unless child.nav_exclude -%}
+ -
+ {%- if page.url == child.url or page.parent == child.title -%}
+ {%- assign second_level_url = child.url | relative_url -%}
+ {%- endif -%}
+ {%- if child.has_children -%}
+
+ {%- endif -%}
+ {{ child.title }}
+ {%- if child.has_children -%}
+ {%- assign grand_children_list = pages_list | where: "parent", child.title | where: "grand_parent", node.title -%}
+
+ {%- endif -%}
+
+ {%- endunless -%}
+ {%- endfor -%}
+
+ {%- endif -%}
+
+ {%- endif -%}
+ {%- endunless -%}
+ {%- endfor -%}
+
diff --git a/lib/tasks/search.rake b/lib/tasks/search.rake
index 163fb03..6b0900e 100644
--- a/lib/tasks/search.rake
+++ b/lib/tasks/search.rake
@@ -3,23 +3,68 @@ namespace :search do
task :init do
puts 'Creating search data json file...'
mkdir_p 'assets/js'
- touch 'assets/js/search-data.json'
- content = %Q[{{ page.content | markdownify | replace: '\' -%}
+ {%- assign title = titleAndContent[0] | replace_first: \'>\', \'\' | split: \'\' -%}
+ {%- assign title = title[1] | strip_html -%}
+ {%- assign content = titleAndContent[1] -%}
+ {%- assign url = page.url -%}
+ {%- if title == page.title and parts[0] == \'\' -%}
+ {%- assign title_found = true -%}
+ {%- else -%}
+ {%- assign id = titleAndContent[0] -%}
+ {%- assign id = id | split: \'id="\' -%}
+ {%- if id.size == 2 -%}
+ {%- assign id = id[1] -%}
+ {%- assign id = id | split: \'"\' -%}
+ {%- assign id = id[0] -%}
+ {%- capture url -%}{{ url | append: \'#\' | append: id }}{%- endcapture -%}
+ {%- endif -%}
+ {%- endif -%}
+ {%- unless i == 0 -%},{%- endunless -%}
+ "{{ i }}": {
+ "doc": {{ page.title | jsonify }},
+ "title": {{ title | jsonify }},
+ "content": {{ content | replace: \'