EC-CUBEでトップページのタイトルを変更する。

【ステップ①】
ECCUBEでデフォルトになっているtitle等の設定が書かれているのはdata/Smarty/templates/default/site_frame.tplの42行目です。

<title><!--{$arrSiteInfo.shop_name|h}--><!--{if $tpl_subtitle|strlen >= 1}--> / <!--{$tpl_subtitle|h}--><!--{elseif $tpl_title|strlen >= 1}--> / <!--{$tpl_title|h}--><!--{/if}--></title>

これを以下のように書き換えます。

<!--{if $tpl_title == "TOPページ"}--><!--トップページの時-->
<title>ここにトップページのtitleタグを自由に</title>
<meta name="description" content="ここにトップページのdescriptionタグを自由に" />
<meta name="keywords" content="ここにトップページのkeywordsタグを自由に" />

<!--{elseif $tpl_title == "商品一覧ページ"}--><!--商品一覧ページの時-->
<title><!--{$tpl_subtitle}--> | ○○○○</title>
<meta name="description" content="○○○○" />
<meta name="keywords" content="○○○○" />

<!--{elseif $tpl_title == "商品詳細ページ"}--><!--商品詳細ページの時-->
<title><!--{$tpl_subtitle}--> | ○○○○</title>
<meta name="description" content="<!--{if $arrProduct.note}--><!--{$arrProduct.note|escape}--><!--{else}-->noteが設定できていない時に表示するもの<!--{/if}-->" />
<meta name="keywords" content="<!--{if $arrProduct.comment3}--><!--{$arrProduct.comment3|escape}--><!--{/if}-->" />

<!--{else}--><!--その他の場合-->
<title><!--{$tpl_title|escape}--> | ○○○○</title>
<meta name="description" content="<!--{$arrPageLayout.description|escape}-->" />
<meta name="keywords" content="<!--{$arrPageLayout.keyword|escape}-->" />
<!--{/if}-->


【ステップ②】
トップページに表示させるためのコード変更 data/class/pages/LC_Page_Index.php の65行目の
$this->tpl_title = ''; 

$this->tpl_title = 'TOPページ'; 

に変更してください。

0 件のコメント:

コメントを投稿