更改结构化标签的传递数据

master
Layne 2 years ago
parent d711e5e333
commit 506039d094

@ -1949,17 +1949,13 @@ class Information extends CI_Controller
$ads_by_google = !empty (get_meta($information->ic_id, 'meta_google_ad_article'));
$data['ads_by_google'] = $ads_by_google;
$data['author'] = ''; //获取作者信息
$author_type = null;
$author = $this->Operator_model->get_author_nikename($information->ic_author);
if (!empty ($author)) {
$author_type = 'operator';
$data['author'] = $author->OPI_FirstName;
} else {
$author_web = $this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等
if (!empty ($author_web)) {
$author_type = 'info_author';
$data['author'] = $author_web->a_name;
$author = $author_web;
}
}
$data['breadcrumb_data'] = $breadcrumb_data;
@ -1968,7 +1964,7 @@ class Information extends CI_Controller
// 结构化标签Article
$article_structured_data_content = $this->load->view(
$template_path . '-structured-data-article',
array('information' => $information, 'author' => $author, 'author_type' => $author_type),
array('information' => $information, 'author' => $data['author']),
true
);
$template = str_replace('<!--@STRUCTURED-DATA-ARTICLE-BLOCK@-->', $article_structured_data_content, $template);

@ -14,15 +14,7 @@
"dateModified": "<?php echo date('Y-m-d\TH:i:s'); ?>",
"author": {
"@type": "Person",
"name": "<?php
if ($author_type) {
if ($author_type == 'operator') {
echo $author->OPI_FirstName;
} else if ($author_type = 'info_author') {
echo $author->a_name;
}
}
?>"
"name": "<?php echo $author; ?>"
},
"publisher": {
"@type": "Organization",

Loading…
Cancel
Save