|
ClientGasJs
A new client script using Google AJAX Search API for related content
Featured IntroductionThis is a new experimental method to get a list of related content, it is still based on labels. You can read how I installed it on my blog. FactsNow, a quick comparison with brps.js. Pros
Cons
Others
Known Issues
InstallationThe steps are simple as brps.js: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script src="http://brps.appspot.com/gas.js"></script> <h2>Related Posts</h2> <div id="gas-results"></div> If your website already have jQuery installed, then you can omit the first line of code, just to make sure you include gas.js after jQuery is loaded. CustomizationYou can customize it with the options as follow: <script>
window.brps_gas = {
remove_tags: ['unwanted_tag1', 'unwanted_tag2'],
tag_selector: 'a[rel=tag]',
limit: 5,
add_sites: ['secondblog.blogspot.com', 'thirdblog.blogspot.com'],
remove_string_regexp: /^.*?: /,
exclude_url_regexp: /(\/search\/label\/|(archive\.html|blog\.example\.com\/|\.blogspot\.com\/)$)/,
html_loading: '<span>Loading...</span>',
html_no_results: '<span>Found no results.</span>'
};
</script>tag_selector is added because some blog template might not be standard or it's possible to use tag_selector for a normal website. remove_string_regexp is added because normal Blogger blog will have titles like 'Blog Name: Post Title'. It will be strange to read it, you can use this option in regular expression to remove "Blog Name: " from result string. If you need to match these characters in remove_string_regexp: \/+*?(){}|, you may need to prefix with \, e.g. \\, \(. If you still don't know how to enter, please ask in discussions group. Note: for matching single quote (apostrophe) ' or double quote " in the title, since they are HTML escaped, you will need to use ' or " to match them, respectively. There might be more characters are escaped. Basically, you don't have to match them, standard Blogger blog's title can be matched by the regular expression as shown in the code block above, i.e. /^.*?: /. exclude_url_regexp can remove archive pages (archive\.html$), label pages (\/search\/label\/), and homepage of blogs by matching the link urls. Questions/Inputs?Please ask your questions at Discussions Group. |