Commit 2797e942 by Scott

Move microdata meta tag

parent 9b1eb365
...@@ -303,9 +303,9 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt ...@@ -303,9 +303,9 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt
// Useful stuff used throughout function // Useful stuff used throughout function
$postid = $post['postid']; $postid = $post['postid'];
$isquestion = ($post['basetype'] == 'Q'); $isquestion = $post['basetype'] == 'Q';
$isanswer = ($post['basetype'] == 'A'); $isanswer = $post['basetype'] == 'A';
$iscomment = ($post['basetype'] == 'C'); $iscomment = $post['basetype'] == 'C';
$isbyuser = qa_post_is_by_user($post, $userid, $cookieid); $isbyuser = qa_post_is_by_user($post, $userid, $cookieid);
$anchor = urlencode(qa_anchor($post['basetype'], $postid)); $anchor = urlencode(qa_anchor($post['basetype'], $postid));
$elementid = isset($options['elementid']) ? $options['elementid'] : $anchor; $elementid = isset($options['elementid']) ? $options['elementid'] : $anchor;
...@@ -465,14 +465,6 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt ...@@ -465,14 +465,6 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt
$netvotes = abs($netvotes); $netvotes = abs($netvotes);
$netvoteshtml = $netvotesPrefix . qa_html(qa_format_number($netvotes, 0, true)); $netvoteshtml = $netvotesPrefix . qa_html(qa_format_number($netvotes, 0, true));
// ...with microformats if appropriate
if ($microdata) {
// vote display might be formatted (e.g. '2k') so use meta tag for true count
$netvoteshtml .= '<meta itemprop="upvoteCount" content="' . qa_html($netvotes) . '"/>';
$upvoteshtml .= '<meta itemprop="upvoteCount" content="' . qa_html($upvotes) . '"/>';
}
// Pass information on vote viewing // Pass information on vote viewing
// $voteview will be one of: // $voteview will be one of:
...@@ -492,6 +484,12 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt ...@@ -492,6 +484,12 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt
$fields['netvotes_view'] = ($netvotes == 1) ? qa_lang_html_sub_split('main/1_vote', $netvoteshtml, '1') $fields['netvotes_view'] = ($netvotes == 1) ? qa_lang_html_sub_split('main/1_vote', $netvoteshtml, '1')
: qa_lang_html_sub_split('main/x_votes', $netvoteshtml); : qa_lang_html_sub_split('main/x_votes', $netvoteshtml);
// schema.org microdata - vote display might be formatted (e.g. '2k') so we use meta tag for true count
if ($microdata) {
$fields['netvotes_view']['suffix'] .= ' <meta itemprop="upvoteCount" content="' . qa_html($netvotes) . '"/>';
$fields['upvotes_view']['suffix'] .= ' <meta itemprop="upvoteCount" content="' . qa_html($upvotes) . '"/>';
}
// Voting buttons // Voting buttons
$fields['vote_tags'] = 'id="voting_' . qa_html($postid) . '"'; $fields['vote_tags'] = 'id="voting_' . qa_html($postid) . '"';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment