Most popular this week: Star ratings rich snippet on Google SERP with Graddit (for Blogger).

Friday, January 25, 2013

Blogspot template with Graddit widgets: mlnpics

Download template

From time to time I'm going to modify and publish free Blogspot templates witn Graddit widgets included. First example mlnpics is based on Queen template from DZignine.
Main page:

Post:

Key features:
  • used widgets: ratings, tops, aggregator;
  • default "Prev" and "Next" links are replaced with posts titles;
  • menu contains links to static pages, those pages display top posts (each page has it's own category). Order of the posts is controlled by graddit widgets and based on average rating. This kind of things are not provided by Blogspot platform by default — something that your visitors may find interesting;
  • users can navigate using Ctrl + left and Ctrl + right arrows, easier navigation = better user experience.

Live demo: http://mlnpics.blogspot.com.
Template source code is not yet published, please write your comments here if you think something should/might be changed. Download links will appear here later.

Important: template does not contain Graddit copyright, but it contains a copyright of the authors of the original template, that should stay untouched, you can not remove it.

Download template


Rate this posting:
{[['']]}

You might like:

Tuesday, December 4, 2012

How to delete old posts from ratings

Sometimes it happens that you need to delete a post from your blog. If you're using graddit best posts widget then your deleted post (if it was popular) will keep showing in tops for some time. As post is no longer existing its title, thumbnail and link itself will be broken. To speed up the process of removal of such posts from tops in Statistics tab of the graddit administer panel you now have new options:

  • X - remove rating history without rating total removal. This allows you to remove post from tops widget, but keep ratings stats (views, votes, etc.);
  • ☠ - remove rating completely.
After rating removal corresponding row in statistics will be marked pink. If a rating was removed completely it will be eliminated from the grid after you refresh the stats page.



Rate this posting:
{[['']]}

You might like:

Sunday, November 4, 2012

How to sort blogger posts by popularity

Blogger offers 2 options to sort your posts: sort by newest and sort by oldest. With Graddit widgets you can sort posts by their popularity. Look at this page: http://fruitfulbookmarks-en.blogspot.com/p/top-posts.html. It displays 5 top articles from this blog. And this one: http://fruitfulbookmarks-en.blogspot.com/p/top-posts-about-blogspot.html shows best posts announcements tagged with "blogspot".
These aren't regular posts, these are Bloggers static pages. If you'll open their source code you'll see that there are no actual posts, only some javascript code. To create your own pages like those you'll need:
  1. create an account if you still don't have it;
  2. create a desired top here;
  3. add graddit-extras.js into <head> section of your template:
    <script src='http://static.graddit.com/js/graddit-extras.js' type='text/javascript'/>
  4. create static HTML page, switch to HTML edit mode and add jQuery, if you don't have it already in your template:
    <script src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' type='text/javascript'/>
  5. add JS function that will process your posts:
    <script type='text/javascript'>
    function gradditLoadTopPosts(id) {
    var element = $("#" + id);
    if (element.length > 0) {
    var wrapperDiv = $("#top5");
    if (wrapperDiv.length == 1) {
    element.find("a").each(function(i, a) {
    var host = a.hostname;
    var blogHost = "fruitfulbookmarks-en.blogspot";
    if (host.indexOf(blogHost) >= 0) {
    var docHost = document.location.host + "";
    var level1Doc = docHost.substring(blogHost.length, docHost.length);
    var level1Post = host.substring(blogHost.length, host.length);
    var link = a.href;
    if (level1Doc != level1Post) {
    link = link.replace(blogHost + level1Post, blogHost + level1Doc);
    }
    var containerId = "top_posts_" + i;
    wrapperDiv.append("<div id='" + containerId + "' style='display: none;'></div>");
    var container = $("#" + containerId);
    container.load(link);
    setTimeout(function() {
    var post = container.find("div[class='post hentry']");
    if (post.length > 0) {
    var newText = "";
    if (i > 0) {
    newText = "<hr style='width: 100%; clear: both;'/>"
    }
    newText += gradditCutText(post.html(), 900, 2) + "<" + "br /><" + "br/>";
    var startIdx = newText.indexOf("<h3 class=\"post-title entry-title\">");
    var endIdx = newText.indexOf("</h3>");
    newText = newText.substr(0, startIdx) + "<a href='" + link + "'>" + newText.substr(startIdx, endIdx - startIdx + 5) + "</a>" + newText.substr(endIdx, newText.length);
    container.html(newText);
    container.show();
    }
    }, 2000 * (i + 1));
    }
    });
    }
    }
    }
    </script>
    Couple of words about changes you might need to make to this function in order to make it working with your blog:
    • #top5 - this is id if the container element, you'll see it below; depending on the template you might need to change the names of the classes;
    • in line var blogHost = "fruitfulbookmarks-en.blogspot"; replace blog URL with your own; do not include country domain (.com, .co.uk, etc.)!
    • when calling function gradditCutText to cut text of your posts there are few parameters you might want to change: second parameter is max length of text, third one allows you to control how to cut it (0 - do nothing, 1 - cut to word, 2 - expand to word). If you don't want to cut text then pass both parameters equal to 0;
  6. add HTML elements and tops script call with callback function:
    <div id="top5"></div>
    <div id="graddit_top_wrapper" style="visibility: hidden; display: none;"></div><script type="text/javascript" src="http://www.graddit.com/showtop/eng/33?id=graddit_top_wrapper&callback=gradditLoadTopPosts"></script>
    Make sure to change top id (33 here) to your own that should be taken from administer page (when you create/manage tops).

It should be ready now. Besides that tops got new parameter: labels. Now you can specify which posts (with what tags) should be displayed in tops widgets. So (if you're familiar with JS) on a page you can display top posts filtered by categories. Try it, let me know what you think.



Rate this posting:
{[['']]}

You might like:

Saturday, October 20, 2012

Ratings widget for Tumblr

Graddit now supports Tumbl microblogging platform. Examples here. To insert a single rating you'll need to copy code from ratings page Generic tab and paste it into desired place while composing new post. To be able to use javascript inside posts you'll have to make some configuration changes:
To edit settings login to tumblr and press preferences icon (1). Set Edit post using to plain text/HTML (2).

You'll also need to add graddit.css styles in theme settings. Go to theme customization, press Edit HTML button
Add styles
<link type="text/css" rel="stylesheet" href="http://static.graddit.com/css/graddit.css"/>

to <head> section
Press Update Preview, then Save (if the button appeared). Everything is ready now to use single ratings.

If you'd like ratings to appear on each post automatically you'll need to make some more modifications to your theme template. First decide where you want ratings to appear: what kind of material, what part of post, should it be visible on the main page or only on internal pages, etc. Then try to find corresponding place in the template. Not with all the templates it will be easy to do; experiment with some harmless piece of text first (maybe even with comments). For example, for ratings to be displayed on the top of text posts below the titles on the main page and on internal pages, code needs to be added into {block:Posts} inside {block:Text} block right after closing {/block:Title}
Don't forget to save the template. Widgets code should be taken from the ratings page Tumblr tab.

Ask questions here if you have any issues with widgets in Tumblr.
Ratings widget for Tumblr, 4.62 out of 5 based on 8 ratings


Rate this posting:
{[['']]}

You might like:

Monday, October 15, 2012

External related posts

Related posts widget got better. Now you can link to external pages with one click right on recommendations tab in administrator interface.
Screenshot:
How it works:
  1. In "switch to" field (1) you enter URL of a page from site you want to link to (that site should have ratings widget installed and a key should be generated). Press Enter and wait until it's loaded.
  2. Chose a parent page on the left panel. Click link (2) to connect recommended page.
  3. If you setup widget to display thumbnails, for external pages they should be specified manually. For Blogspot users it's easy, just click on (3).
Don't forget to save changes. Every time you switch to a new site it's address will be displayed below as a link for quick switching. To switch to pages of the site that you're currently managing click on "Self" link. Links display up to 3 recently used sites.

Important: to be able to switch to site this site's "Allow other users to see my ratings" option should be turned on.

Reminding what is what on recommendations page. On the left panel there're the parent pages that you're creating recommendations for. Parent page you're working on right now is expanded and marked green. On the right panel there're the pages of your site. To create new parent page click on "←"; to connect page with parent click on "✓". Lightgray boxes mark pages already connected to selected parent, lightgreen boxes mark pages picked automatically based on labels (but not yet connected).

Coming soon: automatic feed detection (to avoid manual thumbnails setup) and automatic detection of similar pages from external sites.


Rate this posting:
{[['']]}

You might like:

Friday, September 21, 2012

Hacking Blogger Dynamic Views to support custom widgets

Blogger Dynamic Views are cool, but they support only few official widgets. Today we're hacking dynamic views to support any custom widgets (using Graddit widget as an example, of course).

Disclaimer. This is dirty hacking, it can stop working at any time and can even negatively affect behaviour of your blog. You were warned.

So, the goal is to make widgets appear when user expands a post in any view (Classic, Flipcard, Magazine, Mosaic, Sidebar, Snapshot and Timeline).

First, open Blogger dashboard and go to Template tab; click Edit HTML and then Proceed button.
For dynamic views we can't change a part of the template that displays posts - it will not work. But we still can change head section. Add the following lines to <head>...</head>:

<link href='http://static.graddit.com/css/graddit.css' rel='stylesheet' type='text/css'/>
<script src='http://static.graddit.com/js/graddit-extras.js' type='text/javascript'/>

These are styles and some cool scripts. Actually, we will need only one function called gradditBloggerDynamicViewsRatingsHack. Now go to the very bottom of the template and add this call just before closing </body> tag:

<script type='text/javascript'>setTimeout(function(){gradditBloggerDynamicViewsRatingsHack();},1000);</script>

Or this if you want also to display related posts (You Might Like widget):

<script type='text/javascript'>setTimeout(function(){gradditBloggerDynamicViewsRatingsHack(true);},1000);</script>

Now save template and close editor. Click Customize button to add some styles (without them stars will not show properly). Select Advanced and then click Add CSS. Add this:

.article .article-content .ffbs_rate img {
padding: 0;
border: 0;
border-image: none;
-webkit-border-image: none;
vertical-align: middle;
}

.article .article-content .ffbs_stats {
font-size: 10px;
}

.article .article-content a {
border: 0;
}

Click Apply to Blog.

Now it should be working, open your blog and try! Here's live demo: http://ffbs-widgets.blogspot.com/.
Did it work for you?


Rate this posting:
{[['']]}

You might like:

Sunday, September 16, 2012

Graddit polls widgets

Graddit presents new widgets for polls that you can build into your blogs and sites. Here's a simple poll example:

{[['Bad','  |  '],['Average','  |  '],['Awesome']]}

Number of options and text can be changed. Take code from graddit page, options are set like this:

{[['Bad','&nbsp;&nbsp;|&nbsp;&nbsp;'],['Average','&nbsp;&nbsp;|&nbsp;&nbsp;'],['Awesome']]}, where '&nbsp;&nbsp;|&nbsp;&nbsp;' are the separators between options; number of options should match the number that is passed to the script as a parameter (3 in this example).

I can be not just text, but any HTML valid element. For example, images:

Who rocks?
{[['','    '], ['','    '], ['']]}


And of course general polls. How do you like the new widgets?
{[['So so'],['Okay'],['Perfect']]}


Rate this posting:
{[['']]}

You might like:

Monday, September 3, 2012

Graddit ratings statistics

There's a new tab in admin panel called "Statistics" that allows you to see detailed data about ratings, views, votes and feedbacks numbers. Also you could get some interesting details such as Google Pagerank, Alexa Rank, Facebook and Twitter mentions (later this will be extended). Here's the tab screenshot:

It's sortable. To get information about a page click corresponding ⟳ link. Leave your suggestions here in comments.



Rate this posting:
{[['']]}

You might like:

Friday, July 6, 2012

Styling best posts and related posts widgets

Play a bit with the styles of top posts or related posts in the administer interface and you could get cool looking widgets like this:

Cool looking widget styles and settings:

Image style:
Title style:
li style:
Container style:
Cut text after 20 characters and then "cut to word";



Rate this posting:
{[['']]}

You might like:

Sunday, June 24, 2012

Managing widgets behavior with the callback functions

    By default widgets are displayed on the pages at the place where you set them initially. How to make widget to be shown only when a user riches bottom of the page and be hidden when user scrolls up? To make a solution easier widgets support callback parameter. Using this parameter you can pass control to your function after widget call has completed. More than that, file http://www.graddit.com/js/graddit-extras.js already contains working callback function. Let's see how it works using top posts widget as an example.

Here's the widget call code (it's being called right from this place):
<div id='callback_example' style='visibility: hidden; display: none; position: fixed; right: 10px; bottom: 10px;'>Read our best!</div><script type="text/javascript" src="http://www.graddit.com/showtop/eng/4?id=callback_example&callback=gradditDisplayWidgetCallback"></script>

The call is here, but you can't see the widget; it's behavior has been changed by gradditDisplayWidgetCallback function. From now on it will be displayed on the right bottom corner of the page when you scroll it all the way down. And disappear when you scroll back up.

    If you'd like to use javascript function from the example above you'll need to include the js file in your template:

<script type="text/javascript" src="http://www.graddit.com/js/graddit-extras.js"></script>

    That's it! Remeber: you need to include graddit-extras.js and set callback function in the widget call code. From time to time I'll be adding some useful functions into graddit-extras.js (check for updates).

    Reminder: widgets layout can be easily changed from the admin panel.


Rate this posting:
{[['']]}

You might like: