客戶需求:移除 ECMall 首頁標題中的「商城首頁」四字,僅顯示站點名稱。經排查,標題內容由變數 $page_seo 整合輸出,包含 title、description、keywords 三者,需單獨修改 title 部分配置。
themes/mall/tmall/top.html → 發現 <span>{$page_seo}</span>app/default.app.php → DefaultApp::index() 方法中配置 SEO<?php
class DefaultApp extends MallbaseApp {
function index() {
$this->assign('index', 1);
$this->assign('icp_number', Conf::get('icp_number'));
// 關鍵:_config_seo 陣列中的 title 組合
$this->_config_seo(array(
'title' => Lang::get('mall_index') . ' - ' . Conf::get('site_title'),
));
$this->assign('page_description', Conf::get('site_description'));
$this->assign('page_keywords', Conf::get('site_keywords'));
$this->display('index.html');
}
}
將 Lang::get('mall_index') . ' - ' 移除,僅保留站點標題:
'title' => Conf::get('site_title'),
<title>商城首頁 - 我的購物網站</title><title>我的購物網站</title>同理,app/ 目錄下各模組的 .app.php 控制器中皆有 _config_seo() 呼叫,可針對商品頁、分類頁、文章頁分別自訂 title/description/keywords。
實測專案:www.meichigou.com(已上線)