sajari-website
Advanced tools
Comparing version 0.8.1 to 0.9.0
{ | ||
"name": "sajari-website", | ||
"version": "0.8.1", | ||
"version": "0.9.0", | ||
"description": "Website extensions for the Sajari API. Automatically index site content, add user profiles, render search and recommendations, etc.", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -185,2 +185,29 @@ /* | ||
/** | ||
* Looks for specific field=value pairs on html elements | ||
*/ | ||
fieldValMeta : function(node, attrs) { | ||
var pre = this.prefix; | ||
this.eachNode('field', function(node) { | ||
var val = node.getAttribute(pre+"value"); | ||
var field = node.getAttribute(pre+"field"); | ||
var attr = ""; | ||
if (val !== undefined && val !== null) { | ||
attr = val; | ||
} else if (node.innerHTML !== undefined &&node.innerHTML !== null) { | ||
attr = node.innerHTML; | ||
} | ||
if (attr !== "") { | ||
if (typeof attrs[field] === 'undefined') { | ||
attrs[field] = attr; | ||
} else if (typeof attrs[field] === 'object') { | ||
attrs[field].push(attr); | ||
} else if (typeof attrs[field] === 'string') { | ||
var old = attrs[field]; | ||
attrs[field] = [old, attr]; | ||
} | ||
} | ||
}) | ||
}, | ||
/** | ||
* Returns the URI parameters of dynamic this.prefix attributes | ||
@@ -187,0 +214,0 @@ */ |
@@ -32,3 +32,3 @@ require("./utils/polyfills"); | ||
'related', 'best', 'search-recent', 'search-noresults', 'search-error', 'personalization', 'overlay', | ||
'local' | ||
'local', 'field' | ||
] | ||
@@ -615,4 +615,4 @@ }; | ||
// Set the company | ||
company: function(newCompany) { | ||
opts.company = newCompany + ''; | ||
company: function(newProject) { | ||
opts.project = newProject + ''; | ||
}, | ||
@@ -755,7 +755,8 @@ | ||
page.meta = hash.Meta(document); | ||
dom.dynamicMeta(document, page.meta); | ||
dom.dynamicMeta(document, page.meta); // old style, e.g. data-sj-meta-field | ||
dom.fieldValMeta(document, page.meta); // new style e.g. data-sj-field="field" | ||
// Add the readability MD5 hash for the page to the data sent with indexing ping | ||
page.bodyMD5 = hash.Hash(document); | ||
page.metaMD5 = hash.ObjHash(page.meta); | ||
page.bodyChecksum = hash.Hash(document); | ||
page.metaChecksum = hash.ObjHash(page.meta); | ||
@@ -762,0 +763,0 @@ // Send page for indexing |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
483533
14746