From 23ff03d4e48f199e54fcea55f53a465eb3392673 Mon Sep 17 00:00:00 2001 From: Layne <2320908474@qq.com> Date: Thu, 21 Mar 2024 10:17:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=93=E6=9E=84=E5=8C=96=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9C=A8=E7=BA=BF=E4=BD=9C=E8=80=85=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/information.php | 9 ++++++++- .../views/mobile_first/ah-structured-data-article.php | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/application/controllers/information.php b/application/controllers/information.php index 224aa8c6..906d597f 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -1956,15 +1956,22 @@ class Information extends CI_Controller $author_web = $this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等 if (!empty ($author_web)) { $data['author'] = $author_web->a_name; + $author = $author_web; } } $data['breadcrumb_data'] = $breadcrumb_data; $template_H1 = $this->load->view($template_path . '-h1', $data, true); $template = str_replace('', $template_H1, $template); // 结构化标签:Article + $author_type = null; + if (!empty($author)) { + $author_type = 'operator'; + } else if (!empty($author_web)) { + $author_type = 'info_author'; + } $article_structured_data_content = $this->load->view( $template_path . '-structured-data-article', - array('information' => $information, 'author' => $author), + array('information' => $information, 'author' => $author, 'author_type' => $author_type), true ); $template = str_replace('', $article_structured_data_content, $template); diff --git a/application/views/mobile_first/ah-structured-data-article.php b/application/views/mobile_first/ah-structured-data-article.php index 2b03ebbe..93d63653 100644 --- a/application/views/mobile_first/ah-structured-data-article.php +++ b/application/views/mobile_first/ah-structured-data-article.php @@ -14,7 +14,13 @@ "dateModified": "", "author": { "@type": "Person", - "name": "OPI_FirstName; ?>" + "name": "OPI_FirstName; + } else if ($author_type = 'info_author') { + echo $author->a_name; + } + ?>" }, "publisher": { "@type": "Organization",