الجمعة، 29 مارس 2013

rating Datalife engine news for Google to release schema.org

rating Datalife engine news for Google to release schema.org 

 

 

Hello, friends. Today decided to burn another topic to modify our beloved engine DLE – we do mikrorazmetku Top News for the extended snippet Google Rich Snippets. As you remember, last time we did mikrorazmetku bread crumbs, if you have not read it, do it now.images-rating-google
In contrast to the previous post, where the chance to trigger our completions was 100%, but this time we will work with the probability of completion “luck – bad luck.” Got Game we, have abused this mikrorazmetkoy and Google cut off for most sites extended snippets. However, the tiny probability of inclusion for your website such beauty still exists. So it is a sin not to try!
Look, here’s an example found at Google for his own blog:
* – My blog is powered by WordPress, and create fake markings, I’ve included it here simply as an example of the layout.
This markup I instilled Dunno how long ago and had forgotten all about it, but it sometimes occurs, you see. As for what Google algorithm chooses where show star, I do not know, because marked all the posts, and the beautiful snippet shown for just a few posts and they are constantly changing.
By the way, please pay attention to the fact that I have a snippet, there are beautiful bread crumbs, but I do not mark up ‘, Google it himself identified and built into the snippet for all of my website. And what is even more interesting, I’ve seen a few examples of sites that have not been marked-star ratings, but Google still shows them in the snippet. Knowing all this, it becomes clear that especially something to manipulate these things will not work, the search engine will still make their own way.
No matter what we try, someone so lucky.
Modification rating news for DLE mikrorazmetku
Attention! Several conditions, failure of which leads to various problems and errors:
- These instructions apply to DLE versions 9.6 and 9.7. (For earlier versions, there are a couple of solutions in the comments, but I can not vouch for them.)
- Mandatory setting engine! Configuring user groups -> Guests -> tab “News” -> Enable of rating news: Yes.
- Output rating from category pages might disable, ie remove references to ratings from the template shortstory.tpl. Or you can do the following – # comment-13374 – but I would not recommend it.
So, we have finished the engine a few files to make things work the way we want it, as well as apply a few tricks, but first things first …
Begin, open the file / engine / modules / functions.php and find:
function ShowRating($id, $rating, $vote_num, $allow = true) {
 global $lang;

 ...

 return $rated;
}

function userrating($id) {
Where in my code should be three dots, there is a lot of code, I cut it, do not be important for us to find the beginning and the end.
Select the code I specified and replace it with the following:
function ShowRating($id, $rating, $vote_num, $allow = true) {
 global $lang;

 if( $rating AND $vote_num ) $rating = round( ($rating / $vote_num), 0 );
 else $rating = 4;
 $AVERrating = $rating;
 $rating = $rating * 17;

 if( !$allow ) {

  $rated = <<<HTML
<div>
  <ul>
  <li style="width:{$rating}px;">{$rating}</li>
  </ul>
</div>
HTML;

  return $rated;
 }

 $rated = <<<HTML
<div id='ratig-layer-{$id}'><div>
  <ul itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating">
  <li itemprop="average" style="width:{$rating}px;">{$AVERrating}</li>
  <li><a href="#" title="{$lang['useless']}" onclick="doRate('1', '{$id}'); return false;">1</a></li>
  <li><a href="#" title="{$lang['poor']}" onclick="doRate('2', '{$id}'); return false;">2</a></li>
  <li><a href="#" title="{$lang['fair']}" onclick="doRate('3', '{$id}'); return false;">3</a></li>
  <li><a href="#" title="{$lang['good']}" onclick="doRate('4', '{$id}'); return false;">4</a></li>
  <li itemprop="best"><a href="#" title="{$lang['excellent']}" onclick="doRate('5', '{$id}'); return false;">5</a></li>
  </ul>
</div></div>
HTML;

 return $rated;
}

function userrating($id) {
The code in the right places have added all the necessary tags, as well as used my little “trick”, which I’ll discuss shortly.
With this file finished – save and upload to the server, replacing the former.
Open the file / engine / modules / show.full.php and find the code:

  if( $row['allow_rate'] ) { 

   $tpl->set( '{rating}', ShowRating( $row['id'], $row['rating'], $row['vote_num'], $user_group[$member_id['user_group']]['allow_rating'] ) );
   $tpl->set( '{vote-num}', "<span id=\"vote-num-id-".$row['id']."\">".$row['vote_num']."</span>" );
   $tpl->set( '[rating]', "" );
   $tpl->set( '[/rating]', "" );

  } else {
Replace the code with the following:
if ( $row['vote_num'] == 0 ) $row['vote_num'] = 1;

  if( $row['allow_rate'] ) { 

   $tpl->set( '{rating}', ShowRating( $row['id'], $row['rating'], $row['vote_num'], $user_group[$member_id['user_group']]['allow_rating'] ) );
   $tpl->set( '{vote-num}', "<span itemprop=\"votes\" id=\"vote-num-id-".$row['id']."\">".$row['vote_num']."</span>" );
   $tpl->set( '[rating]', "" );
   $tpl->set( '[/rating]', "" );

  } else {
Save the file, upload to the server, replacing the previous version of the file.
It’s time to talk about “tricks” – it is this. If, for example, the news is very recent, then it is unlikely to have data on the rating, just one has cast a vote, and then the number of votes is equal to 0, and this is a mistake, well, that is, Google will tell you that we are deceiving and no rating we do not have. So, I modified the code so that if we have 0 votes, it is “as if” there is one voice, and it solves the problem with an error, the rating will be approved by Google.
And now, the files are modified engine, remained the final touch – add a rating to the template of our theme. Even if you have already shown in the rating patterns, it will have to seriously modify. In any case, I recommend my version, it is certainly working.
Open the file / templates / * name of your theme * / fullstory.tpl after {full-story} add the code:
[rating]<div itemscope itemtype="http://data-vocabulary.org/Review-aggregate"><div style="float:left;width:100px;">Рейтинг:</div>{rating}<div style="float:left;width:120px;">(голосов: {vote-num})</div></div>[/rating]
If suddenly it will appear crooked in your template, then, sorry, not my fault, please read already, finally, what is the CSS. And do not ask me questions in the comments, such as “help, all curves and move out, I am a complete noob.” Sooner or later, will still have to teach, and if not, will remain a moron and complete noobies. So do please favor …
Here is how it :) As simple as do the instructions, is not it?
It remains to check that everything is done correctly with the structured data verification tool Google.
Should get something like this:
Displaying extended snippet with a rating in Google
Once again, may I remind you that the probability of such a snippet shows how we check tool is extremely small, but it is!
More details about this option can be found in mikrorazmetki manuals Google. Also given all three to markup: microdata, microformats and RDFa. In the above case, I decided to use microdata is no fundamental difference between the two is no, they work the same way.
Now cross your fingers and dream that mikrorazmetka rankings like Google News, and he turned it. And there, and a serious increase in CTR, good traffic growth positions, mountains of dough … you are lying on a hammock, sipping a cocktail and watch the palm trees … Dream on, right?

ليست هناك تعليقات:

إرسال تعليق