Commit 9f1907d8 by Scott

Fix errors in structured data

parent ef53ed4c
...@@ -572,8 +572,12 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt ...@@ -572,8 +572,12 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt
$fields['what'] = qa_lang_html($isquestion ? 'main/asked' : ($isanswer ? 'main/answered' : 'main/commented')); $fields['what'] = qa_lang_html($isquestion ? 'main/asked' : ($isanswer ? 'main/answered' : 'main/commented'));
if (@$options['whatlink'] && strlen(@$options['q_request'])) { if (@$options['whatlink'] && strlen(@$options['q_request'])) {
$fields['what_url'] = ($post['basetype'] == 'Q') ? qa_path_html($options['q_request']) $fields['what_url'] = $post['basetype'] == 'Q'
? qa_path_html($options['q_request'])
: qa_path_html($options['q_request'], array('show' => $postid), null, null, qa_anchor($post['basetype'], $postid)); : qa_path_html($options['q_request'], array('show' => $postid), null, null, qa_anchor($post['basetype'], $postid));
if ($microdata) {
$fields['what_url_tags'] = ' itemprop="url"';
}
} }
} }
...@@ -737,7 +741,7 @@ function qa_message_html_fields($message, $options = array()) ...@@ -737,7 +741,7 @@ function qa_message_html_fields($message, $options = array())
* @param int $postuserid The post user's ID. * @param int $postuserid The post user's ID.
* @param array $usershtml Array of HTML representing usernames. * @param array $usershtml Array of HTML representing usernames.
* @param string $ip The post user's IP. * @param string $ip The post user's IP.
* @param bool|string $microdata Whether to include microdata (no longer used). * @param bool|string $microdata Whether to include microdata.
* @param string $name The author's username. * @param string $name The author's username.
* @return array The HTML. * @return array The HTML.
*/ */
......
...@@ -592,7 +592,6 @@ function qa_post_html_defaults($basetype, $full = false) ...@@ -592,7 +592,6 @@ function qa_post_html_defaults($basetype, $full = false)
'blockwordspreg' => qa_get_block_words_preg(), 'blockwordspreg' => qa_get_block_words_preg(),
'showurllinks' => qa_opt('show_url_links'), 'showurllinks' => qa_opt('show_url_links'),
'linksnewwindow' => qa_opt('links_in_new_window'), 'linksnewwindow' => qa_opt('links_in_new_window'),
'microformats' => $full,
'fulldatedays' => qa_opt('show_full_date_days'), 'fulldatedays' => qa_opt('show_full_date_days'),
); );
} }
......
...@@ -260,7 +260,7 @@ $microdata = qa_opt('use_microdata'); ...@@ -260,7 +260,7 @@ $microdata = qa_opt('use_microdata');
if ($microdata) { if ($microdata) {
$qa_content['head_lines'][] = '<meta itemprop="name" content="' . qa_html($qa_content['q_view']['raw']['title']) . '">'; $qa_content['head_lines'][] = '<meta itemprop="name" content="' . qa_html($qa_content['q_view']['raw']['title']) . '">';
$qa_content['html_tags'] .= ' itemscope itemtype="http://schema.org/QAPage"'; $qa_content['html_tags'] .= ' itemscope itemtype="http://schema.org/QAPage"';
$qa_content['main_tags'] = ' itemscope itemtype="http://schema.org/Question"'; $qa_content['main_tags'] = ' itemprop="mainEntity" itemscope itemtype="http://schema.org/Question"';
} }
......
...@@ -1955,13 +1955,16 @@ class qa_html_theme_base ...@@ -1955,13 +1955,16 @@ class qa_html_theme_base
{ {
if (isset($post['what'])) { if (isset($post['what'])) {
$classes = $class . '-what'; $classes = $class . '-what';
if (@$post['what_your']) if (isset($post['what_your']) && $post['what_your']) {
$classes .= ' ' . $class . '-what-your'; $classes .= ' ' . $class . '-what-your';
}
if (isset($post['what_url'])) if (isset($post['what_url'])) {
$this->output('<a href="' . $post['what_url'] . '" class="' . $classes . '">' . $post['what'] . '</a>'); $tags = isset($post['what_url_tags']) ? $post['what_url_tags'] : '';
else $this->output('<a href="' . $post['what_url'] . '" class="' . $classes . '"' . $tags . '>' . $post['what'] . '</a>');
} else {
$this->output('<span class="' . $classes . '">' . $post['what'] . '</span>'); $this->output('<span class="' . $classes . '">' . $post['what'] . '</span>');
}
} }
} }
......
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