Browse Source

Exclude pages from search

how to do array.contains http://stackoverflow.com/a/1473742/177116

how to read xml http://jquerybyexample.blogspot.com/2012/04/read-and-process-xml-using-jquery-ajax.html

idea to load page list from sitemap http://appzman.com/blog/?p=384
Talha Mansoor 12 years ago
parent
commit
e409a3df80
1 changed files with 5 additions and 1 deletions
  1. 5 1
      static/tipuesearch/tipuesearch_set.js

+ 5 - 1
static/tipuesearch/tipuesearch_set.js

@@ -22,6 +22,8 @@ var tipuesearch_stem = {"words": [
 
 var tipuesearch_pages;
 
+exclude_pages = ['/archives.html', '/tags.html', '/index.html', '/categories.html', '/search.html'];
+
 function showGetResult()
 {
      var result = new Array();
@@ -34,7 +36,9 @@ function showGetResult()
         success: function(xml) {
             $(xml).find('url').each(function(){
                 var loc = $(this).find('loc').text();
-                result.push(loc);
+                if ($.inArray(loc, exclude_pages) < 0) {
+                    result.push(loc);
+                }
             });
         },
         error: function() {