Tampilkan postingan dengan label tops. Tampilkan semua postingan
Tampilkan postingan dengan label tops. Tampilkan semua postingan

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";

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.

Ratings from Graddit: related posts and tops

Today's topics: what are and how to setup and display the recommendations (related posts) and tops widgets.

In order to be able to use widgets described below you need to get access to the account management panel. Open the link, click on "Generate secret key" and follow the instruction. After you login to the management panel you'll see 3 tabs: Settings, Recommendations and Tops.


Settings

Let's leave this page for now, it is created for the future purposes. All what you can do there now is change the secret key and allow/forbid token generation. If generation is forbidden you couldn't reset the secret key with a token. You might need to reset secret key if you lost it; restoration of a secret key via email isn't yet implemented.



Recommendations


Please check out the possible issues below before reporting any problems with this page.
Here you can create the lists of related (recommended) materials for each page on your website where you have rating widget installed. At the left hand side of the page you'll find the relations you've already created; at the right hand side - pages you can create relations for. For example, if you want to create relations for the page with URL http://fruitfulbookmarks-en.blogspot.com/2012/04/how-to-duplicate-rating-information.html, you need to click "←" link near that URL; that creates a container. Then by pressing "✓" you could add the related URLs into the container. Click on the image above to see a bigger image, that will help to understand the process better. When you add the links their titles will be loaded automatically. You can change them though. You can change the links as well, but you'll have to set the titles manually in this case. Save the recommendations. There are 2 ways to display the widget:
  1. copy the code (for now there's only code for Blogger) and paste it into the desired place of your blog's template. In this case for all the pages of your blog the related posts will be displaying automatically (of course if you created them first).
  2. if you wish to display a particular list of recommended materials then click the "Preview" link and copy the given code into the desired place of your page (or post). In this case (if you haven't forgotten include styles http://graddit.com/css/graddit.css) when viewing the page you'll see something like this:
    With some code added:
    <div id='graddit_recommendation' style='display: inline; visibility: hidden;'><div style='background-image: url(http://img.graddit.com/favicon.ico); display: inline-block; width: 16px; height: 16px;'></div> You can change this title</div><script src='http://graddit.com/rec/eng/6527129645013929210?id=graddit_recommendation'></script>
    you can get something like this (with changed title):
Possible issues.
  • Resolved; update widget code. At the right hand side you can't see the pages' URLs, mostly the URLs of the main page. That can happen if you have rating widget shown at the main page (not under cut only), in this case when people vote ratings get assigned with the main page URL. This will be fixed soon. Nevertheless, if you could figure out real addresses of the displayed ratings, the related posts will be shown at the proper pages. If you don't want to get too deep into the mechanism of the ratings just wait for the fix.
  • For now you can't create recommendations not related to a page with the rating widget installed. This will be fixed soon.
  • Manually create recommendations is too hard and boring. Is there a way to make it in automatic mode? Yep, it's boring, but it gives you much more control over the process and you can add materials more relevant to the shown pages. I'm planning to implement some automation though. You will be able to display related URLs for the pages without manually created recommendations; the options will be: show random links for the given set, display another widget using callback function, automatic links based on labels (tags).


Update. Related posts widget has become better; read more.

Tops

Tops are a bit easier to control. Top is a lists of pages that got more votes, rating or views:

You can set:
  1. number of displayed links;
  2. maximum top refresh time (in minutes, not less than 60 and not more than 1440 - these limits will be changed after I'll get some stats data);
  3. sort criteria (number of votes/number of views/average rating);
  4. options:
    • only for the last preiod - if ticked, top will be formed based on short period of time information; if not ticked, the current values of views/votes/rating will be taken as a base;
    • less rated records first - sort order;
    • exclude main page - links to the main page will not be displayed in the top widget;
    • load titles - load pages titles when displayed in tops. Loading will not happen every time top is displayed; data will be cached for the period of 12 hours (maximum);
    • drop URL parameters - recommended to be set; this will help you to get rid of the links to the same pages having different parameters in the URLs (for example, ?showComment=...). Of course if these parameters are not important for your site;
    • show ratings near to links - show sort criteria values. I recommend to have it turned on before you actually expose top to the users and turn it off then; users don't need to see this and might get confused;
  5. inline styles - try various parameters to change the layout of your top widget;
  6. "cut text after" - maximum number of characters in the displayed URL (or titles); 0 - do not cut.
Playing with online styles can help you get something like this:


That's all folks. Ask questions, criticize, tell me how would like to change these widgets. Found a mistake? Use the misspellings tracking widget at the top right corner of the page. Stay tuned.